Power BI Variables

hatstand

Well-known Member
Joined
Mar 17, 2005
Messages
778
Office Version
  1. 2016
Platform
  1. Windows
Hi All,

I am looking to create a Query that holds multiple variables that are used in many Queries, rather than creating the variable within individual Querys. As an example, the Query could hold, Earliest and Latest Dates (to allow me to build a dynamic range calendar), Words that are replaced through all Querys etc etc

I have looked far and wide for the answer, so maybe it can't be done, or maybe it isn't a good idea. It would make administration easier, so before giving up I thought I would ask the experts.

Thanks.
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
It sounds to me like a parameter table, although I wouldn't recommend mixing things like earliest/latest dates with lists of words to replace.
 
Upvote 0
Thanks for the reply, Rory. I take your point about mixing the data types in one column, I could split the data into columns. I have created a table with a few test variables, below. I can find the Row number in another Query using 'List.PositionOf(Var[Variable],"Month")'. In this example it returns '2'. What I am stuck on now is how would I use the returned Row number to give me the value in the variables tables. So give me Row 2 in the Variable Column.

Is this possible as it would make it far easier for staff to administer all the variables in one Query.

let
Var = {2}[Variable],
Source = #table(
type table[ Variable = Text.Type, Value = Text.Type ],
{
{ "Earliest Date", List.Min(Sales[Dates]) },
{ "Latest Date", List.Max(Sales[Dates])},
{ "Month", "January"}
}
),
#"Added Index" = Table.AddIndexColumn(Source, "Index", 0, 1, Int64.Type)
in
#"Added Index"
 
Upvote 0
I think that what would be best, instead of me trying to re-invent the wheel. Thanks for the helps, it's very much appreciated.
 
Upvote 0

Forum statistics

Threads
1,223,362
Messages
6,171,642
Members
452,415
Latest member
mansoorali

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top