Forum Discussion
Conditional Formatting Dax
I am still getting the same result.
I have now created a date table as you suggested and have created a link in the data model between the date table and table I am visualising in the matrix. I can't think of what could be the problem. Do you have any thoughts?
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!
- Anonymous2 years agoNot applicable
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.