Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
AdamMetz23
Regular Visitor

How to use DAX formula SELECTEDVALUE with Field Parameters

Dear Power BI community,

 

I would like to ask for your help as I am trying to use DAX formula SELECTEDVALUE based on field parameters, however it is not doable based on the following error message:

AdamMetz23_0-1677489956714.png

 

IF user selects between two value the (Amount USD & Amount LCL) the calculation should be changing based on that:

DAX formula :

AdamMetz23_1-1677490209440.png

 

Field Parameter:

AdamMetz23_2-1677490237278.png

 

Visualization selection for Amount USD & Amount LCL:

AdamMetz23_3-1677490307581.png

 

 

Would it be possible for someone to help how to change the DAX formula SELECTEDVALUE part to make it work?

Thank you for your advice in advance.

 

Wishing you a wonderful date.

 

Adam

 

 

 

2 ACCEPTED SOLUTIONS
andhiii079845
Super User
Super User

Can you perhaps upload a example file without sensitve datas? 
Other post to field parameters 
It seems to be possible. Perhaps try first to access only to the field parameter value? 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

Did you try to add a "calculate" in the var Lastyeardynamic:
Lastyeardynamic = calculate(max(DWH[year])) ? 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

7 REPLIES 7
andhiii079845
Super User
Super User

What was the solution now in your case ? 🙂





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




I have added the year column values explicitly instead of using a MIN & MAX measure to find the first and last year in the year column.

 

I am not 100% clear how it connects to the original issue to be honest but solved the problem.

 

AdamMetz23_0-1677501679722.png

 

Did you try to add a "calculate" in the var Lastyeardynamic:
Lastyeardynamic = calculate(max(DWH[year])) ? 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Oh thank you I have added calculate and it made the formula more dynamic. Thank you.

andhiii079845
Super User
Super User

Can you perhaps upload a example file without sensitve datas? 
Other post to field parameters 
It seems to be possible. Perhaps try first to access only to the field parameter value? 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




andhiii079845
Super User
Super User

One question: Why it is important to use field parameters instead of a regular table / calculated table? 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thank you Andhi for your quick reply.

 

Actually the main reason for that is that this was the only way (based on my knowledge) how I could dynamically change the column chart visualization Y axis between amount usd and amount lcl based on the field parameter selection:

AdamMetz23_0-1677491582316.png

 

Is it inefficient to do so?

Thank you,

Adam

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.