Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Dynamix value based on a slicer result

Hi  Very new to Power BI so please excuse me if the terminology is incorrect!

I want to compare to locations' results based on various measures.  i have set up location 1 and location 2 measures based on two slicers. i can see all the data correctly but the headers dont show the location names, just location 1 and loaction 2

 

example

Net Sales Location 1 =
CALCULATE(
    [Sold Amount],
    FILTER(
        Locations,  
        Locations[LocationName] in {SELECTEDVALUE('First Location'[LocationName])}
        )
 
Net Sales Location 2 =
CALCULATE(
    [Sold Amount],
    FILTER(
        Locations,  
        Locations[LocationName] in {SELECTEDVALUE('SecondLocation'[LocationName])}
        )
  
How do i return the location name (e.g. London or Birmingham) based on the slicer selection rather than the default wording location 1 or Location 2?
 
Thanks
 
GordyMac
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Anonymous ,

     

    Dynamic measure names are unavailable.

    Since you really need two seperate slicers, you could create two seperate tables for the two slicers' fields.

    My sample data.

     

    1.Create two calculated tables.Using calculated tables in Power BI Desktop - Power BI | Microsoft Learn

    There's no relationship between three tabls.

    2.Create two measures for the selection of both slicers.

    Here's the result.

    You can also calculate the difference.

     

     

    Best Regards,

    Stephen Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    thanks for responding.  I looked at the video thanks and i have similar results.  Where my headers come back with Location 1 and Location 2 his are showing Net Brand 2 and Net Brand 3.  What i'm hoping to find a solution for is changing this description to which location (or brand in the video example) has been selected in the slicer.

     

    So in the example video i would want the headers to say Brand 4 and Brand 5

     

    thanks

     

    Gordon

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    If you don't insist on two slicers to filter two LocationNames, try multi-selecting in one slicer. Hold down Ctrl and click the mouse to multi-select.

    This way you don't have to create a separate LocationName table, you can use LocationName directly from your main table(Locations table).

     

    Best Regards,

    Stephen Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks Stephen for reply.  I do need two location tables as this slicer goes across multiple visualisations on sevreal pages.  Using your method i could never find a way to calculate a difference, is that possible?

      So on your image location A - Location B would equal 100 or 50%

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Anonymous ,

         

        Dynamic measure names are unavailable.

        Since you really need two seperate slicers, you could create two seperate tables for the two slicers' fields.

        My sample data.

         

        1.Create two calculated tables.Using calculated tables in Power BI Desktop - Power BI | Microsoft Learn

        There's no relationship between three tabls.

        2.Create two measures for the selection of both slicers.

        Here's the result.

        You can also calculate the difference.

         

         

        Best Regards,

        Stephen Tao

         

        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.