The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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.
User | Count |
---|---|
77 | |
75 | |
36 | |
31 | |
29 |
User | Count |
---|---|
93 | |
81 | |
57 | |
48 | |
48 |