Forum Discussion

AdamMetz23's avatar
AdamMetz23
Icon for Advocate I rankAdvocate I
3 years ago
Solved

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:

 

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

DAX formula :

 

Field Parameter:

 

Visualization selection for Amount USD & Amount LCL:

 

 

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

 

 

 

7 Replies

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

    • AdamMetz23's avatar
      AdamMetz23
      Icon for Advocate I rankAdvocate I

      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:

       

      Is it inefficient to do so?

      Thank you,

      Adam

    • AdamMetz23's avatar
      AdamMetz23
      Icon for Advocate I rankAdvocate I

      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.

       

       

      • andhiii079845's avatar
        andhiii079845
        Icon for Solution Sage rankSolution Sage

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