Forum Discussion

John117's avatar
John117
New Member
4 years ago
Solved

Create table with what-if parameters

Hello!

 

I'm trying to create a dynamic table with DAX functions where one of the columns shows the value that user input in the what-if parameter. For example if the user enter these values for what-if parameters:

My table should shows:


I'm tryng to use this DAX function to create the table, but it don't work (the error message is: too many arguments were passed to the SELECTEDMEASURE function. The maximum argument count fot the function is 0):

 

Any suggestion?

 

Thank you so much!

  • Hi John117 

    Try this:

    • Create a table with one column with the Value names
    • Create the measure below

    I used an IF() but use a SWITCH () if there are more values.


    Let me know if you have any questions.

    If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos πŸ‘are nice too.
    Nathaniel

     

     

    Value table =
    VAR _curValue1 = 'Value 1'[Value 1 Value]
    VAR _curTableValue =
        MAX ( newtable[Value] )
    VAR _curValue2 = 'Value 2'[Value 2 Value]
    RETURN
        IF ( _curTableValue = "Value 1", _curValue1, _curValue2 )

     

6 Replies

  • Nathaniel_C's avatar
    Nathaniel_C
    Icon for Community Champion rankCommunity Champion

    Hi John117 

    Try this:

    • Create a table with one column with the Value names
    • Create the measure below

    I used an IF() but use a SWITCH () if there are more values.


    Let me know if you have any questions.

    If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos πŸ‘are nice too.
    Nathaniel

     

     

    Value table =
    VAR _curValue1 = 'Value 1'[Value 1 Value]
    VAR _curTableValue =
        MAX ( newtable[Value] )
    VAR _curValue2 = 'Value 2'[Value 2 Value]
    RETURN
        IF ( _curTableValue = "Value 1", _curValue1, _curValue2 )

     

  • Nathaniel_C's avatar
    Nathaniel_C
    Icon for Community Champion rankCommunity Champion


    Let me know if you have any questions.

    If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos πŸ‘are nice too.
    Nathaniel