March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
How to Change the Bar graph's color to orange only when the 5 consecutive increments of the value? in power bi
I only changed the color from mar-toJulyy to orange the rest remain blue
Month
Value
Jan | 200 |
Feb | 250 |
Mar | 180 |
Apr | 280 |
May | 290 |
Jun | 300 |
July | 350 |
Aug | 150 |
Sep | 179 |
Oct | 800 |
Nov | 200 |
Dec | 400 |
Hi @Kotebe
Thanks for the reply from Sahir_Maharaj .
The following measures are for your reference, I added an index column to your original data.
Consecutive Increments =
VAR _CurrentIndex = MAX('Table'[Index])
VAR _CurrentValue = MAX('Table'[Value])
VAR _Prev1 = CALCULATE(MAX('Table'[Value]), FILTER(ALL('Table'), 'Table'[Index] = _CurrentIndex - 1))
VAR _Prev2 = CALCULATE(MAX('Table'[Value]), FILTER(ALL('Table'), 'Table'[Index] = _CurrentIndex - 2))
VAR _Prev3 = CALCULATE(MAX('Table'[Value]), FILTER(ALL('Table'), 'Table'[Index] = _CurrentIndex - 3))
VAR _Prev4 = CALCULATE(MAX('Table'[Value]), FILTER(ALL('Table'), 'Table'[Index] = _CurrentIndex - 4))
VAR _CheckIncrements =
IF(_CurrentValue > _Prev1 && _Prev1 > _Prev2 && _Prev2 > _Prev3 && _Prev3 > _Prev4, 1, 0)
RETURN
_CheckIncrements
Color =
VAR _Index =
MAXX(FILTER(ALL('Table'), [Consecutive Increments] = 1), 'Table'[Index])
RETURN
IF(
MAX('Table'[Index]) IN {_Index, _Index - 1, _Index - 2, _Index - 3, _Index - 4},
"orange",
"blue"
)
Then set the conditional format in format your visual -> Columns -> Color.
Output:
Best Regards,
Yulia Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This a summarized table, How can Like Order date in Table 1 and Date in Date table Product in Tabl1
The one above is only a summarized table from the Date table and Table1 if I add Product to the summarized table I the aggregation is not working
Thank you
Hello @Kotebe,
Can you please try creating a calculated column to identify if a bar meets the condition:
Consecutive Increments =
VAR CurrentMonth = 'Table'[Month]
VAR CurrentValue = 'Table'[Value]
VAR PreviousValues =
TOPN(
5,
FILTER(
'Table',
'Table'[Month] < CurrentMonth
),
'Table'[Month], DESC
)
VAR IsIncrement =
IF(
COUNTROWS(PreviousValues) = 5 &&
MAXX(PreviousValues, 'Table'[Value]) < CurrentValue,
TRUE(),
FALSE()
)
RETURN
IF(IsIncrement, "Orange", "Blue")
Then you can apply conditional formatting.
Hope this helps.
These gives me all bar chart blue, even though it has orange section
Have you test these code?
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
87 | |
85 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |