Forum Discussion
mikeminu
1 year agoRegular Visitor
Conditional Formatting on Matrix based on same measure comparison
Good afternoon everyone, I hope everyone is well and can maybe help me with a problem I am trying to solve. I created a matrix visual with dates on the columns and index names on the rows. I ...
- Anonymous1 year ago
Thanks for the reply from lbendlin, please allow me to provide another insight.
Hi mikeminu ,
Please refers to the following steps.
Below is my testing data table.Create a date table and establish a relationship with the source table.
DimDate = ADDCOLUMNS( CALENDAR(MIN('Table'[Date]),MAX('Table'[Date])), "Year", YEAR([Date]) )
Use the following measure to set the conditional format of the matrix values.Measure = VAR SelectedYear = SELECTEDVALUE(DimDate[Year]) VAR CurrentYearValue = CALCULATE([Sum of price], DimDate[Year]=SelectedYear) VAR PreviousYearValue = CALCULATE([Sum of price], DimDate[Year]= SelectedYear-1) RETURN SWITCH( TRUE(), CurrentYearValue>PreviousYearValue,1, CurrentYearValue<PreviousYearValue,-1, 0 )
The final result is as follows. Hopefully it will meet your needs.Please see the attached pbix for reference.
Best Regards,
Dengliang Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
lbendlin
1 year agoSuper User
You cannot measure a measure directly. Either materialize it first, or create a separate measure that implements the entire business logic.