The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. 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
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
20 | |
18 | |
17 | |
15 | |
13 |
User | Count |
---|---|
39 | |
32 | |
22 | |
19 | |
18 |