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.
Is it possible to change the color of the bars in a chart, based on date? Values today and after today has another color than before today. I am using this on sales - values to be delivered, and values of backlog
Solved! Go to Solution.
Hi @Anonymous , you can achieve this by following these steps.
1)Create a column in your table for holding the difference in date with respect to today's date in days. You can use the following DAX for the column.
Date Difference = DATEDIFF(TODAY(),Sheet1[Sample Date ],DAY)
You'll get a column like this
2)Create a bar chart and use conditional formatting based on the Date Difference column to get different colours for values having date equal to and greater than today and for values having date less than today. Go to conditional formatting by clicking on fx Button(Shown below)
3) Then you can can set the "Format by" field as "Rules" and use the following rules.
The result will look like this. The values with negative date difference have red colour and the values with zero and positive date difference have green colour.
The date as of writing this answer is 9th July 2021, so the values for 9th July and above have green color and the values having date before 9th July have red colour.
The .pbix file is attached for reference.
Regards,
Aditya
I don't see the option to get conditional formating am I using the wrong chart type or version?
I'm using clustered columns chart and line and clusteres columns chart.
The operations Qtr1 have 3 with -5 days and its not red on the column. I appreciate any help on this matter, thank you 🙁
Hello! why my graphic doesnt show the red color on the negative values on my graph?
This was also exactly what I was looking for - thank you! I have a 13-month rolling trend chart and wanted to highlight last month vs. last month prior year. Using your formula to create a "Months Ago" column in my date table did the trick.
Thank you! This is what I'm looking for!
Best regards, Ingrid
Hi @Anonymous , you can achieve this by following these steps.
1)Create a column in your table for holding the difference in date with respect to today's date in days. You can use the following DAX for the column.
Date Difference = DATEDIFF(TODAY(),Sheet1[Sample Date ],DAY)
You'll get a column like this
2)Create a bar chart and use conditional formatting based on the Date Difference column to get different colours for values having date equal to and greater than today and for values having date less than today. Go to conditional formatting by clicking on fx Button(Shown below)
3) Then you can can set the "Format by" field as "Rules" and use the following rules.
The result will look like this. The values with negative date difference have red colour and the values with zero and positive date difference have green colour.
The date as of writing this answer is 9th July 2021, so the values for 9th July and above have green color and the values having date before 9th July have red colour.
The .pbix file is attached for reference.
Regards,
Aditya
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
100 | |
78 | |
75 | |
52 |
User | Count |
---|---|
144 | |
109 | |
108 | |
88 | |
61 |