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
hiren89vora
Frequent Visitor

Legend in Bar Chart

Hi,

 

Can anyone help with the legends in the bar chart. If nothing is selected in the slicer then it should pick type1 as the legend and if we select anyone or more then it should show type2 as legend.

 

hiren89vora_0-1652433964619.png

 

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

HI @hiren89vora,

For your scenario, I'd like to suggest you write a measure formula with an if statement and isfiltered function to check the selections.

After these steps, you can use this measure on the value field to replace the raw field to achieve your requirement.

ISFILTERED, ISCROSSFILTERED – DAX Guide - SQLBI

If you are confused about the coding formula, please share some dummy data to test.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

HI @hiren89vora,

For your scenario, I'd like to suggest you write a measure formula with an if statement and isfiltered function to check the selections.

After these steps, you can use this measure on the value field to replace the raw field to achieve your requirement.

ISFILTERED, ISCROSSFILTERED – DAX Guide - SQLBI

If you are confused about the coding formula, please share some dummy data to test.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
amitchandak
Super User
Super User

@hiren89vora , You Have Create mesure like

 

=

var _is = calculate(isfiltered(table[type]), allselected())

return

If(_is , [Measure], calculate([Measure], filter(Table, Table[Type] = "type 1" ) ) )

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.