Forum Discussion

aghonaim's avatar
aghonaim
Most Valuable Professional
10 years ago
Solved

How to reference a parameter to a DAX function ?

Is it possible to reference a parameter to a DAX function and how ?

8 Replies

  • ankitpatira's avatar
    ankitpatira
    Community Champion

    aghonaim In power bi desktop go to query editor -> right click your parameter and ensure Enable Load is checked. Then Parameters are just like any other query in Power BI Desktop and so you can reference them in DAX expressions.

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Where can we use these paramters once created? I can't find any way to use them.

  • Mfd's avatar
    Mfd
    New Member

    It is possible through multiple steps, 2 possibilites exist depending on the volume of your tables 

     

    1. Use powerquery and merge your table with the parameter. The parameter will repeat on every line. You can then use it through calculations directly in powerquery, or with DAX. 

     

    Parameter 1 : 0,5


    Vendor

    John 1
    John 2
    John 3

    With an outerleft join, 

    VendorParameter 1
    John 10,5
    John 20,5

     

    2. If your data has high volume, reference the parameter on your fact table using power query. like in example 1 

    In your 2nd table, use DAX and reference the value 

    LOOKUPVALUE( 'Infotable'[Parameter1], Info table[Vendor name]>, 'Currenttable'[Vendor] )

     

    This will return the parameter 0,5 to every line, and can then be used for calculations using DAX