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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
PC2790
Community Champion
Community Champion

Conditional formatting of x-axis along with Legend formatting

Greetings community,

 

I have come across a requirement which seemed to be easy in the beginning but it is quite strange that I am not able to get the desired result.

Here it goes:

I have data similar to this:

ID Status Stage Priority
1 In progress S1 1
2 Cancelled S3 2
3 Pending S1 3
4 Completed S2 1
5 Completed S2 2
6 In progress   2
7 Pending S1 1
8 Cancelled S3 3
9 In progress S2 1
10 Pending S1 3

 

I created a bar chart as this:

PC2790_0-1671257661145.png

For the colors of the bars, I have done conditional formatting using DAX as below:

 

Status color =
SWITCH (
TRUE (),
SELECTEDVALUE ( 'Table1'[Status] ) = "In progress", "Red",
SELECTEDVALUE ( 'Table1'[Status] ) = "Completed", "Yellow",
SELECTEDVALUE ( 'Table1'[Status] ) = "Pending", "Blue",
SELECTEDVALUE ( 'Table1'[Status] ) = "Cancelled", "Green"
)

 

Now the requirement is that I have to put legends in form of Priority so that bar shows hoe many of them have what priority.

Expected outcome:

PC2790_1-1671259999055.png

as per:

PC2790_2-1671260021811.png

 

How is that achievable?

  

2 REPLIES 2
negi007
Community Champion
Community Champion

@PC2790 unfortunatley this is not possible as you can't have two different conditions for the chart. However, you can try to use some trick to have this one. You can create two charts and super impose one chart over other like below

 

negi007_0-1671292598724.png

have also attached the pbix file for reference




Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

PC2790
Community Champion
Community Champion

Thankyou @negi007 

That's quite a smart solution but it will not oslve my purpose as no where it shows the Priority value anywhere.

if anyone has any other solution or a better way of show casing this, please help me with it.

 

thankyou

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.