Forum Discussion

ViniChequer's avatar
ViniChequer
Regular Visitor
2 years ago

Change legend based on calculation group

 

Hello,

 

I have created a simple calculation group, with one item like this:

Bikes =
CALCULATE(
    SELECTEDMEASURE(),
    CONTAINSSTRING('Sale'[Detailed Products], "Bikes")
)


Another like this:
Skates =
CALCULATE(
    SELECTEDMEASURE(),
    CONTAINSSTRING('Sale'[Detailed Products], "Skates")
)

When I use them in my data segmentation, I would like to change the legend of a chart, something like this:
Segment =
if(
selectedvalue(Product) = "Bike",
'Supplier"[Bike segment],
'Supplier"[Skate segment],
)


This happens because the same supplier can be a "A Tier" supplier for bikes, but a "B Tier" supplier for skates. Every row in my table is a interaction with the supplier, and the there can be more than one product per interaction.

My solution today is to create two bookmarks (Bikes | Skates) that will hide and show the graphs with different legends.
 
Is there a smartes way to do this?

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi ViniChequer ,

     

    Thanks for reaching out to the community.

    I have some questions I want to confirm with you:

    1.What do your tables look like?

    2.If the bike and skates are in the same field, you can try to do it directly with a slicer.

    If that doesn't work, please provide more details and pay attention to privacy.

     

    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.

     

  • ViniChequer's avatar
    ViniChequer
    Regular Visitor

    The segments are not on the same field.

     

    My clients table have the following info:

    IDSegment for BikesSegment for Skates
    This is the ID i created the relationship with my sales tableShows the Segment for BikesShows the segment for skates