Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Create a Tableau style parameter in Power BI

I'd like to create a "parameter" drop down for users in Power BI similar to Tableau. Simple example using Power BI superstore (linked here). When 1 then 'Segment', when 2 then 'Category', when 3 then 'Region'. 

 

Parameter Table:

 

Parameter_Value

1

2

3

 

Superstore Dataset (simple example)

 

Row

SegmentCategoryRegion
1ConsumerTechnologyEast
2CorporateTechnologyWest
3Home OfficeTechnologyEast
4CorporateTechnologyNorth

 

So expected behavior is this:

 

  1. User selects the 'Parameter Value' via dropdown i.e. 1
  2. DAX measure returns the associated field i.e. SEGMENT column

 

How can this be achieved? I've gotten 75% of the way there, but am getting errors in DAX that I cannot find the field name since the 2 tables are not linked to one another, and there's no primary key to set a relationship. 

  • Anonymous Use something like this:

    Measure =
      VAR __SelectedValue = SELECTEDVALUE( 'Parameter Table'[Parameter_Value] )
      VAR __Result = MAXX( FILTER( 'Superstore Dataset', [Row] = __SelectedValue ), [Segment] )
    RETURN
      __Result
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi, Anonymous 

    Thanks for Greg_Deckler's reply. You can try using his method, if it does not fit your need, try the following dax, and add it to the Filter pane then set to 1.

     

    SlicerFilter =
    VAR _SuperstoreRow =
        SELECTEDVALUE ( 'Superstore Dataset'[Row] )
    VAR _flag =
        IF ( _SuperstoreRow IN ALLSELECTED ( 'Parameter Table'[Parameter_Value] ), 1 )
    RETURN
        IF ( ISFILTERED ( 'Parameter Table'[Parameter_Value] ), _flag, 1 )
    

     

    Best Regards,
    Yang

    Community Support Team

     

    If there is any 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 us know.
    Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

2 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Anonymous Use something like this:

    Measure =
      VAR __SelectedValue = SELECTEDVALUE( 'Parameter Table'[Parameter_Value] )
      VAR __Result = MAXX( FILTER( 'Superstore Dataset', [Row] = __SelectedValue ), [Segment] )
    RETURN
      __Result
  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi, Anonymous 

    Thanks for Greg_Deckler's reply. You can try using his method, if it does not fit your need, try the following dax, and add it to the Filter pane then set to 1.

     

    SlicerFilter =
    VAR _SuperstoreRow =
        SELECTEDVALUE ( 'Superstore Dataset'[Row] )
    VAR _flag =
        IF ( _SuperstoreRow IN ALLSELECTED ( 'Parameter Table'[Parameter_Value] ), 1 )
    RETURN
        IF ( ISFILTERED ( 'Parameter Table'[Parameter_Value] ), _flag, 1 )
    

     

    Best Regards,
    Yang

    Community Support Team

     

    If there is any 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 us know.
    Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum