Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Variable in measure based on slicer selection

Hello dear community, 

 

Merry Christmas to all.
I hope you are well.

I have a question.
I have different simple measures per country to convert the currency.
I would like that when I select the country via a slicer, the measure changes and the result changes everywhere (in the card and if I have a table with several countries, I see the sales by currency).
If I don't select anything, it will be $ by default.

Can you help me?
Thanks in advance for your help

Example 

7 Replies

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

    Anonymous let's say you have table below which has country name and conversion value

     

    you can then create a measure that will extract the rate from the above table basis selection in the slicer for a country

    Currency_convertor =
    var country_selected = SELECTEDVALUE('CURRENCY'[country])
    return
    LOOKUPVALUE('CURRENCY'[rate],'CURRENCY'[country],country_selected)

     

     

    in the above visual, you can see basis selection value is being shown from table. You can customize the measure above to get the final value by calc using measure

  • Anonymous's avatar
    Anonymous
    Not applicable

    Thnak you to you negi007 and ALLUREAN  for your idea. It help me a lot.

    I have a question based on that. 

    Imagine that I have a simple measure (if sales amount are between 1M and 2M then 1 if not0). 

    Is it possible to do this : 

    If I select Country the divide simple mesure by the disctinct count of country. If I choose region divide by distinct count of region, ... ) 

    Do I do every time a measure for each case ? 

     

     

     

    • ALLUREAN's avatar
      ALLUREAN
      Icon for Solution Sage rankSolution Sage

      Здраствуй Anonymous 

       

      You can download the file again. In this case the measure is using distinct static number of countries/regions, it can be dynamic if this is the case.

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hello Sir, 

         

        Thank you for your answer but I can't download the file : 

        Site is unreachable