Forum Discussion
Conditional Formatting Dax
I am not alowed to upload a pbix. So please follow the instructions below:
1. Create the date table in Power query using the link I sent. Choose full years for the data to be generated
2. Mark the table as date table
3. Create a relationship between Dates Date and Month in your data table
4. Create a new measure DAX with the code provided
Matrix Object Color =
VAR _CurrentMonthResult = SUM(DataConD[Value])
VAR _PrevPer = SELECTEDVALUE(Dates[CurrMonthOffset]) - 1
VAR _PreviousMonthResult =
CALCULATE(
SUM(DataConD[Value]),
FILTER(ALL(Dates),
Dates[CurrMonthOffset] = _PrevPer)
)
VAR _Result = IF(_CurrentMonthResult < _PreviousMonthResult, "#F6EEEF", "#F0F6EE")
RETURN
_Result
5. Create a matrix as below
6. Apply conditional format based on the measure DAX (right click on Values - cond format - background color)
7. Mark my answer as the solution. Thanks!
I am still getting the same result, which is a table full of green values. I followed your steps from creating a scratch report too. Not sure why this isn't working.
The join between the Date table and my data table is probably the sticking point. What data type is your month?
When I create a table with just the dates, I get this: (where Date is the column in the date table and the other three columns are from my data table)
- Alex872 years agoSolution Sage
Relationships have the same data type, which is Date.