Forum Discussion
Anonymous
6 years agoNot applicable
Matrix conditional formating based on measure
Good day, I would like to define a background color of matrix entry based on measure. Inside measure I plan to compare 3 entries of that matrix like A, B and C. If they equal - change a color. BU...
Icey
6 years agoCommunity Support
Hi Anonymous ,
Is the result you want like the screenshot below?
If so, you can create your column and measures like so:
column:
Index =
IF (
'Table (2)'[Product] = "P1",
1,
IF ( 'Table (2)'[Product] = "P2", 2, IF ( 'Table (2)'[Product] = "P3", 3, 4 ) )
)measure:
Measure =
VAR PreIndex =
MAX ( 'Table (2)'[Index] ) - 1
VAR NextIndex =
MAX ( 'Table (2)'[Index] ) + 1
VAR PreSales =
CALCULATE (
SUM ( 'Table (2)'[Sales] ),
FILTER (
ALLEXCEPT ( 'Table (2)', 'Table (2)'[Country] ),
'Table (2)'[Index] = PreIndex
)
)
VAR NextSales =
CALCULATE (
SUM ( 'Table (2)'[Sales] ),
FILTER (
ALLEXCEPT ( 'Table (2)', 'Table (2)'[Country] ),
'Table (2)'[Index] = NextIndex
)
)
VAR Condion1 =
IF (
MAX ( 'Table (2)'[Sales] ) = PreSales
&& MAX ( 'Table (2)'[Sales] ) = NextSales,
1,
0
)
RETURN
Condion1Measure 2 =
IF (
SUMX ( ALLEXCEPT ( 'Table (2)', 'Table (2)'[Country] ), [Measure] ) <> 0,
1,
0
)This is my PBIX file.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.