Forum Discussion
Highlighting a change in a table
it does not work.
I apologize for any confusion. To highlight changes in Power BI, you can use conditional formatting with a measure that compares the current month's data with the previous month's data. Let's break it down into simpler steps:
Create a Date Table: Ensure you have a Date table with a relationship to your data table. This Date table should have a continuous sequence of dates covering your entire data range.
Calculate the Previous Month: Create a DAX measure that calculates the previous month. You can use the following DAX expression to do this:
Previous Month = MAX('Date'[Date]) - 1
Create a Measure to Identify Changes: Now, create a measure that compares the current month's data with the previous month's data. Assuming your data table is called "Orders," and you want to compare the "Order Status" column, you can use this DAX measure:
Status Change =
VAR CurrentMonth = MAX('Date'[Date])
VAR PreviousMonth = [Previous Month]
RETURN
IF(
COUNTROWS(
FILTER(Orders, Orders[Order Month] = CurrentMonth)
) > 0
&&
COUNTROWS(
FILTER(Orders, Orders[Order Month] = PreviousMonth)
) > 0
&&
CALCULATE(
COUNTROWS(Orders),
FILTER(Orders, Orders[Order Month] = CurrentMonth && Orders[Order Status] = "Canceled")
) >
CALCULATE(
COUNTROWS(Orders),
FILTER(Orders, Orders[Order Month] = PreviousMonth && Orders[Order Status] = "Canceled")
),
"Changed",
"Not Changed"
)
- Apply Conditional Formatting: Now, go to your table visual, select the "Order Status" column, and apply conditional formatting. Choose "Background color" or "Font color," and set the formatting rule based on the "Status Change" measure. You can specify a color for "Changed" and leave the default for "Not Changed."
With these steps, your table will highlight entries where the status changed from the previous month to the current month. Ensure that your data model is set up correctly, and the column and table names match your actual data.