Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

Creating a Slicer to select data from different calculated columns

Hi,

I've created a table with four calculated columns. These are based on inflation rates and have taken data from different years to factor up to 2020. I am now looking to create a slicer based on the four separate inflation rates that will return the data from each column separately in the various tables and graphs I have created.

 

Can anyone advise me of the best way to do this, as I'm struggling at the moment. 

 

Many thanks

 

David

3 Replies

  • Hi Anonymous ,

     

    Not really sure how you have your setup but if you create a disconnected table with the reference that you need something similar to:

     

    Reference
    Column1
    Column2
    Column3
    Column4

     

    The you can use a switch function to get the values you need for example:

     

    Values calculation=
    Switch( 
    SELECTEDVALUE(Table[Reference]),
    "Column1", SUM(AnotherTable[Column1),
    "Column2", SUM(AnotherTable[Column2),
    "Column3", SUM(AnotherTable[Column3),
    "Column4", SUM(AnotherTable[Column4),
    )

    Now use this measure on your visuals and the table above on your slicer.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Miguel,

      Thank you for your response, I'm not sure if I've set up my tables incorrectly, but this doesn't seem to be working for me. I've created the measure, but I'm not sure what I should use for the Reference. I need to think about the layout before trying this out.

      Many thanks

      David

      • MFelix's avatar
        MFelix
        Super User

        Hi Anonymous 

         

        The reference is just a table that you can call whatever you want and place the name of the column you need to calculate and change, then if you select that table and make the calculations according to the measure your charts should change.

         

        Check PBIX file attach with a small example: