Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Comparing data to date - 1

Hi,

 

I have some data, shown below, and i want to be able to highlight if there was a change in serial number for a particular ID, by comparing to the previous days data. Any ideas what equation would give me the output in red

 

kinseld5_0-1682346293943.png

 

Regards,

David

 

 

1 ACCEPTED SOLUTION
Rudy_D
Resolver I
Resolver I

Hi,

You can use the formula below to create a calculated column.
The trick is to use EARLIER() function that will allow you to check, for each ID, if the serial number has changed compared to the day before.

 

Calculated Column = 

VAR __var1 = 'Table'[Serial Number]

VAR __var2 = CALCULATE(VALUES('Table'[Serial Number]), FILTER(ALL('Table'), 'Table'[Date Created] = EARLIER('Table'[Date Created]) - 1 && 'Table'[ID] = EARLIER('Table'[ID])))

RETURN

IF(ISBLANK(__var2), "NO", IF(__var1 = __var2, "NO", "YES"))
 Rudy_D_0-1682350557876.png

 

View solution in original post

4 REPLIES 4
Rudy_D
Resolver I
Resolver I

Hi,

You can use the formula below to create a calculated column.
The trick is to use EARLIER() function that will allow you to check, for each ID, if the serial number has changed compared to the day before.

 

Calculated Column = 

VAR __var1 = 'Table'[Serial Number]

VAR __var2 = CALCULATE(VALUES('Table'[Serial Number]), FILTER(ALL('Table'), 'Table'[Date Created] = EARLIER('Table'[Date Created]) - 1 && 'Table'[ID] = EARLIER('Table'[ID])))

RETURN

IF(ISBLANK(__var2), "NO", IF(__var1 = __var2, "NO", "YES"))
 Rudy_D_0-1682350557876.png

 

Anonymous
Not applicable

Thank you. This worked. I really appreciate your help 😃

Now to understand why it worked 🤔

Ahmedx
Super User
Super User

pls try this
Screen Capture #924.png

Anonymous
Not applicable

Thank you. Unfortunately i'm getting this error. f_serialnumber is formatted as Text

 

DAX comparison operations do not support comparing values of type True/False with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.