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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
springje
Frequent Visitor

DAX for comparing text fields of snapshot data

I have the following data set:

image.png

I am creating a matrix with Snapshot as the column, Attribute as the row, and I need a measure for using Value as the values. I am comparing the text of the Value column between the 2 snapshots, so I have a slicer for Snapshot that the user will select 2 snapshots.

image.png
I need the Total column to show "Changed" if the values are different, and "Same" or blank if the values are the same. I'm struggling with writing a measure to do this.

1 ACCEPTED SOLUTION

I was able to solve this one:

IF(HASONEVALUE(Data[Snapshot]),FIRSTNONBLANK(Data[Value],0),IF(EXACT(LASTNONBLANK(Data[Value],0),FIRSTNONBLANK(Data[Value],0)),"SAME","CHANGED"))

View solution in original post

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

Well, you are going to need an index or other "order" column so that you know what is before/after what, that should be a combination of your snapshot column and your attribute column. Then you are going to need to use EARLIER. See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395...



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

I'm not trying to compare everything in the table together, just the column values that are sliced to in the matrix. My data will be a monthly snapshot of the same dataset stored in the same table, and I want to look at an attribute and see whether it is the same, or different, in 2 selected snapshots.

 

I've been able to do this looking at dates as values and getting the difference between the dates, but I'm unsure how to do this with text values.

 

It is a fairly simple measure to do this with dates: https://community.powerbi.com/t5/Desktop/Compare-milestone-dates-of-snapshot-data-in-same-table/m-p/...

I was able to solve this one:

IF(HASONEVALUE(Data[Snapshot]),FIRSTNONBLANK(Data[Value],0),IF(EXACT(LASTNONBLANK(Data[Value],0),FIRSTNONBLANK(Data[Value],0)),"SAME","CHANGED"))

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.