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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
suyogbi
Frequent Visitor

Alternating colours for BAR Graph with single measure without any conditional formatting

Hi All,

 

I have a requirement where i need to show alternating colour in bar graph which has only single measure (salesamount) in Values and the AXIS(Customer) around 5000 Customer. there is no condional formatting requirement, just need to show 2 diff colours in alternating format.

 

any work around for this?

 

Thanks in Advance.

Suyog

1 ACCEPTED SOLUTION

@suyogbi , Try like  

sales amount

Rank = rankx(allselected(Table[Customer]), [sales amount])

 

// sales amount is a measure  

 

Color = 

var _1 = mod([Rank],2) 

return 

if(_1,=1, "Blue", "Green")

 

You need use conditional formatting using field value option with this measure 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@suyogbi , No, you have to use conditional formatting to get this.

 

May be create a rank on customer and measure and use mod with 2 and us that in conditional formatting

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak how can we achieve this with conditional format?  i just need to show alternating colour bars. i dont have any specific condition. 

@suyogbi , Try like  

sales amount

Rank = rankx(allselected(Table[Customer]), [sales amount])

 

// sales amount is a measure  

 

Color = 

var _1 = mod([Rank],2) 

return 

if(_1,=1, "Blue", "Green")

 

You need use conditional formatting using field value option with this measure 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak  how to handle the ties here? ties are giving same color in graph.

both skip and dense not helping .. 

 

@amitchandak  Thank you so much. this solves my requirement.😊 cheers.. 👍

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.