Power Query - insert column by repeating single value from another query

Stormin_

New Member
Joined
Jan 31, 2017
Messages
8
Hi,

I have a power query qryTotalSales that simply has SalesAgentID and SalesVolume as an aggregate
Code:
SalesAgentID    SalesVolume
           1             27
           2              4
           3             72
           4             11
In another power query qryThreshold I have restricted it to a single value that I need to use as a threshold
Code:
MinThreshold
          30
I want to insert the threshold value into every row in qryTotalSales so that I get an output of
Code:
SalesAgentID    SalesVolume    MinThreshold
           1             27              30
           2              4              30
           3             72              30
           4             11              30
so that I can then apply a custom true/false column with the function [SalesVolume] >= [MinThreshold] which, if true, will then waive their agent fees for the month.

I can't do this with query merge since there is no matching fields to create a join. In Access, since these are small tables, I'd normally just do a DMax to retrieve the value '30' from qryThreshold. Any idea how to do this in Power Query? (still learning)

Cheers
 
Last edited:

sandy666

Well-known Member
Joined
Oct 24, 2015
Messages
3,311
maybe add custom column with table threshold #"Added Custom" = Table.AddColumn(Source, "Custom", each Table2), then expand
 

Stormin_

New Member
Joined
Jan 31, 2017
Messages
8
Oops, I did the classic "after not finding anything for 10 minutes, I posted the question in the forum, then discovered the actual answer a minute later"!

In qryTotalSales I create a custom column with the formula
Code:
=qryThreshold[MinThreshold]{0}
which pulls the value from TABLE[FIELD]{ROW} where ROW has order 0

I'll leave this up to help anyone else with the same question
 

Forum statistics

Threads
1,078,437
Messages
5,340,277
Members
399,361
Latest member
Linford

Some videos you may like

This Week's Hot Topics

  • Problem with Radio Button's format control
    I am creating an employee evaluation template (a sample is below) Column A is the category Column B, C D, E and F will be ratings (unacceptable...
  • Last Display on userform to a Listbox
    [CODE=vba] lstdisplay.ColumnCount = 15 lstdisplay.RowSource = "A1:O600000" [/CODE] So when i do this it Displays everything on the sheet i am...
  • Rename and move files to a new location
    Dear all, I have an excel file with the following information. The actual file name is at column A but i want to rename it using the following...
  • Help with True/False Formula
    Hello! Am stumped how to fix this formula, in which my result returns 'True', but it should return False. =IF(AG2=True...
  • Clear extra characters from a provided range of cells
    Dear All, I have following code which gives me desired output to remove extra characters from a provided range. But it takes too much time when...
  • Help with Current and highest streaks
    Hi there, I've just joined the forum and this is my first post. I've already spent quite a bit of time searching the net and this forum for a...
Top