The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hello,
I have a DAX function that returns the minimum and maximum date of a list of dates
Date_Init = CALCULATE(MIN(filters_1[Date]), ALLSELECTED(filters_1))
Date_End = CALCULATE(MAX(filters_1[Date]), ALLSELECTED(filters_1))
But when I want to bind a parameter to those functions, the Power Bi app doesn't give me the option to do so.
Is there a way to bind those DAX functions to parameters? Is there another way to do it?
Solved! Go to Solution.
Hi @spmivilsoftbi ,
May I know how you want to bind these function to your parameters? What kind of parameters do you want to bind?
If you define your parameter by New Parameter feature, you could directly use it to do calculation. If your parameter is defined in Power Query Editor(Transform data), you could load it to your model and use it to some calculations in your formula or take it to make a visual just like other fields.
And normally, if you would like to take your parameter value into your formula, you could use SELECTEDVALUE/MAX/MIN in measure or directly use the field name of the parameter in Calculated column. So you could make a little bit change to your formulas like this.
Date_Init = CALCULATE(MIN(filters_1[Date]), FILTER( ALLSELECTED(filters_1),'filters_1'[column name]=SELECTEDVALUE(Your parameter name)))
Date_End = CALCULATE(MAX(filters_1[Date]), FILTER( ALLSELECTED(filters_1), 'filters_1'[column name]=SELECTEDVALUE(Your parameter name)))
Here are the official document about these funcitons.
SELECTEDVALUE function - DAX | Microsoft Docs
MIN function (DAX) - DAX | Microsoft Docs
MAX function (DAX) - DAX | Microsoft Docs
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!
Best Regards,
Community Support Team _ Caiyun
Hi @spmivilsoftbi ,
May I know how you want to bind these function to your parameters? What kind of parameters do you want to bind?
If you define your parameter by New Parameter feature, you could directly use it to do calculation. If your parameter is defined in Power Query Editor(Transform data), you could load it to your model and use it to some calculations in your formula or take it to make a visual just like other fields.
And normally, if you would like to take your parameter value into your formula, you could use SELECTEDVALUE/MAX/MIN in measure or directly use the field name of the parameter in Calculated column. So you could make a little bit change to your formulas like this.
Date_Init = CALCULATE(MIN(filters_1[Date]), FILTER( ALLSELECTED(filters_1),'filters_1'[column name]=SELECTEDVALUE(Your parameter name)))
Date_End = CALCULATE(MAX(filters_1[Date]), FILTER( ALLSELECTED(filters_1), 'filters_1'[column name]=SELECTEDVALUE(Your parameter name)))
Here are the official document about these funcitons.
SELECTEDVALUE function - DAX | Microsoft Docs
MIN function (DAX) - DAX | Microsoft Docs
MAX function (DAX) - DAX | Microsoft Docs
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!
Best Regards,
Community Support Team _ Caiyun
You cannot use DAX measures as Power Query parameters. You could determine the values in PQ and use them in a different table.
let
Source = filters_1,
MinValue = Table.Min(Source,"Date"),
Result = MinValue[Date]
in
Result
User | Count |
---|---|
16 | |
8 | |
7 | |
6 | |
5 |
User | Count |
---|---|
25 | |
13 | |
12 | |
8 | |
8 |