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

Bar/Column chart colour formating using simple Dax functions

Requirement : Lets say we have a requirement where we want to show bar chart in two different colours alternately.
 
In this scenario, lets say we have a simple data and we want to do formatting of of bar chart in specific colour and order then with the help of index column and simple dax function we can acheive this.
 
For this, just create a simple index table like this which is shown below

Capture1.PNG

 

 

 

 

 

 

As we want alternate colour we will add index column and using that we will add colour columns.
Go to edit queried and add index columns.

Capture2.PNG

 

 

 

 

 

 

 

Once Index column is added create new column using following DAX function

 

colour = IF('Sample data'[Index.1] = ODD('Sample data'[Index.1]),1,2)
Capture.PNG

 

 

 

 

 

 

 

This will bring 1 and 2 in clront of each row. Once we get this column go to Report Pane and select Bar chart.

Then, in the Format pane go to Data colurs and select connditonal formating option as follows,

Capture3.PNG

 
Final Output:
Capture4.PNG
 
 
 
 
 
 
 
 
 
NOTE: You can create colour column according to amont or values as well as per  the requireement.
Hope, this will help you in formatting for Bar/Column chart.
 
Thanks and Regards,
Ashwin Kulkarni, BI Consultant
Nice Software Solutions,
Address: 21, IT Park, Wing – A, Ground Floor,
Gayatri Nagar, NAGPUR - 440022 (India)
Mobile: 0712 664 4575
 
1 ACCEPTED SOLUTION
2 REPLIES 2
technolog
Super User
Super User

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.

Top Solution Authors