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.
I want to have a dynmaic color feature for my line chart.
If the value goes up, then the line color should be green and if it goes down then it should be in red.
I have attached screenshot of my visual.
If anyone knows a way, then do please let me know.
Regards,
Sanket Bhagwat
Solved! Go to Solution.
Hi @SanketBhagwat ,
Based on my test, Conditional Formatting is not supported for Line chart currently,but this is at idea/feedback level alone. You could vote some submitted ideas in Power BI ideas forum as shown below :
Conditional formating on linear or area chart ?
Conditionally format line chart
Line Chart Marker Color Conditional Formatting
And based on my test, you may try the following workarounds:
Color In table =
var _curr=CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[Year]=MAX('Table'[Year])))
var _last=CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),'Table'[Year]=MAX('Table'[Year])-1))
return IF(_last>_curr,"Red","Green")
1. Use Stacked column chart
2.Then copy ,paste the Stacked column visual, and change it to Line chart, the data point would change colors as well:
Diff =
var _curr=CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[Year]=MAX('Table'[Year])))
var _last=CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),'Table'[Year]=MAX('Table'[Year])-1))
return _curr-_last
Color for Diff = IF([Diff]>=0,"Green","Red")
3.Use Waterfall chart, data lable is value diff not the value:
4. Use Funnel chart, this charts don't support negative numbers: they're plotted on the chart as zero, so no bars are displayed for negative values. However, despite there being no colored bar, the label for a negative value is displayed on the chart.
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hey @SanketBhagwat ,
as amitchandak mentioned you cannot change the color within one value.
Even if you would split it in 2 measures be aware that at the point where the change happens you have to make sure that both values exist for both measures. Otherwise you will have a gap.
@SanketBhagwat , You can only have color markers, that too you need to have conditional formatting in bar and then use line.
This Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))
diff = [This Year]-[Last Year ]
then create a measure
if([Diff] >0, "Green", "Red")
use this measure in conditional formatting using field value option
How to do conditional formatting by measure and apply it on pie?: https://youtu.be/RqBb5eBf_I4
Then how do you show increasing or decreasing trend?
Is KPI Indicator the only way to show the same?
And if Power BI doesn't offer such functionality, do you guys think that it should be posted as an idea?
Regards,
Sanket Bhagwat
Hi @SanketBhagwat ,
Based on my test, Conditional Formatting is not supported for Line chart currently,but this is at idea/feedback level alone. You could vote some submitted ideas in Power BI ideas forum as shown below :
Conditional formating on linear or area chart ?
Conditionally format line chart
Line Chart Marker Color Conditional Formatting
And based on my test, you may try the following workarounds:
Color In table =
var _curr=CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[Year]=MAX('Table'[Year])))
var _last=CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),'Table'[Year]=MAX('Table'[Year])-1))
return IF(_last>_curr,"Red","Green")
1. Use Stacked column chart
2.Then copy ,paste the Stacked column visual, and change it to Line chart, the data point would change colors as well:
Diff =
var _curr=CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[Year]=MAX('Table'[Year])))
var _last=CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),'Table'[Year]=MAX('Table'[Year])-1))
return _curr-_last
Color for Diff = IF([Diff]>=0,"Green","Red")
3.Use Waterfall chart, data lable is value diff not the value:
4. Use Funnel chart, this charts don't support negative numbers: they're plotted on the chart as zero, so no bars are displayed for negative values. However, despite there being no colored bar, the label for a negative value is displayed on the chart.
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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 |
---|---|
106 | |
105 | |
79 | |
69 | |
61 |
User | Count |
---|---|
143 | |
104 | |
103 | |
82 | |
70 |