Forum Discussion

anusha_2023's avatar
anusha_2023
Icon for Helper IV rankHelper IV
1 year ago
Solved

Country slicer dynamically select Currecny Slicer

I have a Country-city hierarchy Slicer and currency as other slicer.

 

Now When I select any country or city corresponding currency slicer need to be selected. For example

How to approach DAX measure to solve the problem

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi anusha_2023 ,

     

    Do you want the value in the currency slicer to be automatically selected when the city or country is selected? Setting default selection value is not supported in the classic Slicer, but you can try using "Preselected Slicer". 

     

    Please note that Preselected Slicer is a non-Microsoft custom visualization tool. Non-microsoft custom visualizations are subject to errors or charges in the future. This is beyond Microsoft's support. For more information, see the documentation for this visual object here: Preselected Slicer.

     

    Here is my test and attached pbix file for your reference:

    My data.

    1. Create calculated table contains all currency type.

    ALLCurrency = CALCULATETABLE(DISTINCT('Table'[Currency]),ALL('Table'[Currency]))

    2. Create Status table which is used to in "Preselected Slicer".

    3. Create measure which is used to check if currency should be selected.

    Measure = IF(CONTAINS('Table','Table'[Currency],MAX('ALLCurrency'[Currency])),TRUE(),FALSE())

     

    When I select cities in Country.City slicer, the corresponding currency types are automatically selected.

     

     

     

     

    Best regards,

    Mengmeng Li

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi anusha_2023 ,

     

    Do you want the value in the currency slicer to be automatically selected when the city or country is selected? Setting default selection value is not supported in the classic Slicer, but you can try using "Preselected Slicer". 

     

    Please note that Preselected Slicer is a non-Microsoft custom visualization tool. Non-microsoft custom visualizations are subject to errors or charges in the future. This is beyond Microsoft's support. For more information, see the documentation for this visual object here: Preselected Slicer.

     

    Here is my test and attached pbix file for your reference:

    My data.

    1. Create calculated table contains all currency type.

    ALLCurrency = CALCULATETABLE(DISTINCT('Table'[Currency]),ALL('Table'[Currency]))

    2. Create Status table which is used to in "Preselected Slicer".

    3. Create measure which is used to check if currency should be selected.

    Measure = IF(CONTAINS('Table','Table'[Currency],MAX('ALLCurrency'[Currency])),TRUE(),FALSE())

     

    When I select cities in Country.City slicer, the corresponding currency types are automatically selected.

     

     

     

     

    Best regards,

    Mengmeng Li

  • In standard Power BI you cannot programmatically set the "selected" values of a slicer. (It is partially possible in Power BI Embedded and through Report URL parameters)

     

    If this is important to you please consider voting for an existing idea or raising a new one at https://ideas.fabric.microsoft.com