Forum Discussion
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 | Segment | Category | Region |
| 1 | Consumer | Technology | East |
| 2 | Corporate | Technology | West |
| 3 | Home Office | Technology | East |
| 4 | Corporate | Technology | North |
So expected behavior is this:
- User selects the 'Parameter Value' via dropdown i.e. 1
- 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- Anonymous1 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 TeamIf 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_DecklerCommunity 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 - AnonymousNot 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 TeamIf 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