Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
| Site Name | 7/9/2023 | 7/10/2023 | 7/11/2023 |
| Ahangama | 1100 | 1058 | 1070 |
| Akmeemana | 1063 | 1016 | 1094 |
I have above table with some more data. If current dates count is higher than the previous dates count I want to highlight current date count red. If current dates count is less than the previuos dates count I want to highlight current date count red. How to achieve this using power bi?
Solved! Go to Solution.
Hi @mosam ,
"Current dates count is higher than the previous dates count" means the largest count.
1.Here suppose your count is a column.
Raw sample data:
So you can create a measure like:
Measure = var _max=MAXX(FILTER(ALLSELECTED('Table'),[Site Name]=MAX('Table'[Site Name])),[Count])
return IF(_max=SUM('Table'[Count]),"Red")
Conditional Formatting in the matrix:
Result:
2.If you count is a measure.
Raw sample data:
Create a measure for conditional formatting:
Measure 3 = var _max=MAXX(FILTER(ALLSELECTED('Table (2)'),[Site Name]=MAX('Table (2)'[Site Name])),[Measure 2])
return IF(_max=[Measure 2],"red")
After conditional formatting is set, the result is below.
Hope that helps.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @mosam ,
"Current dates count is higher than the previous dates count" means the largest count.
1.Here suppose your count is a column.
Raw sample data:
So you can create a measure like:
Measure = var _max=MAXX(FILTER(ALLSELECTED('Table'),[Site Name]=MAX('Table'[Site Name])),[Count])
return IF(_max=SUM('Table'[Count]),"Red")
Conditional Formatting in the matrix:
Result:
2.If you count is a measure.
Raw sample data:
Create a measure for conditional formatting:
Measure 3 = var _max=MAXX(FILTER(ALLSELECTED('Table (2)'),[Site Name]=MAX('Table (2)'[Site Name])),[Measure 2])
return IF(_max=[Measure 2],"red")
After conditional formatting is set, the result is below.
Hope that helps.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
It depends of rest of date values, but for given dataset this might work.
Then you apply Conditional Formatting to [Count] and in "Format style" you select newly created measure [Formatting].
Formatting =
VAR _Current_Date = MAX( 'Table'[Date] )
VAR _Current_Count = [Count]
VAR _Before = DATEADD( 'Table'[Date], -1, MONTH )
VAR _Before_Count =
CALCULATE(
[Count],
_Before
)
VAR _Result =
IF(
AND( _Current_Count > 0, _Before_Count > 0 ),
IF(
_Current_Count > _Before_Count,
"#BC544B"
)
)
RETURN
_Result
This is the complete table.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 39 | |
| 37 | |
| 29 | |
| 24 |
| User | Count |
|---|---|
| 120 | |
| 95 | |
| 70 | |
| 69 | |
| 65 |