Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

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

 

 

 

 

 

 

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.

 

 

 

 

 

 

 

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)

 

 

 

 

 

 

 

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,

 
Final Output:
 
 
 
 
 
 
 
 
 
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