Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Change legend based on filters

I have 5 bar/line graphs that i want to change the legend based if columns Team or Product are or not filtered.

I have three calculated columns for legend that are: Flag Geral, Flag Team and Flag Product, and i've tried to create a new column like:

 

IF( ISFILTERED([TEAM]), 'Flag Team',
IF( ISFILTERED([PRODUCT]), 'Flag Product',
[Flag Geral]
)
)

But it doesn't work, i always get the last one option (the false option).

These 'Flag...' columns are calculated like this:
Flag Team =
IF( [Access M TEAM] >=5 && [Access M-1 TEAM]<5, "NOVO",

IF( [Access M TEAM]>=5 && ISBLANK([Access M-1 TEAM]) = TRUE, "NOVO",

IF( [Access M TEAM]<5 && [Access M-1 TEAM] >= 5, "CHURN",

IF( [Access M TEAM]>=5 && [Access M-1 TEAM] >=5, "RECORRENTE", "EVENTUAL" )
)
)
)


Flag Product =
IF( [Access M Product] >=5 && [Access M-1 Product]<5, "NOVO",

IF( [Access M Product]>=5 && ISBLANK([Access M-1 Product]) = TRUE, "NOVO",

IF( [Access M Product]<5 && [Access M-1 Product] >= 5, "CHURN",

IF( [Access M Product]>=5 && [Access M-1 Product] >=5, "RECORRENTE", "EVENTUAL" )
)
)
)

 

I've tried, and used, bookmars option, but it doesn't seem right to me, cause i'm gonna create a lot of bookmarks to change between 3 teams, a lot of products and the geral option.

2 REPLIES 2
Greg_Deckler
Super User
Super User

@Anonymous See this link for dynamic axis: https://community.powerbi.com/t5/Quick-Measures-Gallery/Dynamic-EVERYTHING-measures-axis-legend-titles-chart-types/m-p/1027881#M444


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hey @Greg_Deckler , i have seen this link but it doesn't work on my context. In the legend this example uses the "DataBase Legend"[Value], in my context i need that these values be like:

Attribute      Value
Team            My calculated column [FLAG TEAM]
Product        My calculated column [FLAG PRODUCT]

And i cant use measure as legends, and i cant use columns on my legend since it need to be calculated everytime i change my filters (use [FLAG TEAM] if we have a team selected on filter, use [FLAG PRODUCT] if we have a product selected on filter, use [FLAG GERAL] if we dont have anything selected)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.