Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

How to create custom column for a slicer

Hi everyone, 

 

I am new to PowerBi and have quick question. I want to create new collumn called 'country' that would allow me to put it into slicer and when I select specific country it will update the chart accordingly. So for example: if I select Austria from slicer the chart will automatically show values from AT.Buil.  Later on I will add more categories and charts like AT.Service, AT.Retail, etc and ultimately I want that whenever I select any of the countries all charts will show the values on charts. If you have suggestions how to go around this problem and make it more effective, I would highly appreciate that. Thank you. 

  • Hi Anonymous

     

    You may try to use SELECTEDVALUE Function and SWITCH Function to create the measure as requested. For example:

    Value =
    SWITCH (
        SELECTEDVALUE ( Country[Country] ),
        "a", CALCULATE ( SUM ( Table[AT.BUIL] ) ),
        "b", CALCULATE ( SUM ( Table[AT.BUIL2] ) )
    )

     

    Regards,

    Cherie

4 Replies

  • v-cherch-msft's avatar
    v-cherch-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi Anonymous

     

    You may try to use SELECTEDVALUE Function and SWITCH Function to create the measure as requested. For example:

    Value =
    SWITCH (
        SELECTEDVALUE ( Country[Country] ),
        "a", CALCULATE ( SUM ( Table[AT.BUIL] ) ),
        "b", CALCULATE ( SUM ( Table[AT.BUIL2] ) )
    )

     

    Regards,

    Cherie

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you mate you are a legend.  Also, one more if you or anyone could help me with. Have same dates tables across different categories and I want to add all of those dates into one measure so I could add to slicer and then update all sentiment charts similarly as I do with countries. I have tried to use same method but no luck so far. Any advice?

       Thanks in advance