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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

Comparing data to previous date (not necessarily yesterday)

Hi,

 

I have two problems that i need help with please.

 

Problem 1 - I'd like to get the 'Swap Completed' column to say 1, when there is a change from Yes to No in the' Change' column. The equation i am using is not working and i cannot figure out why. 

 

Problem 2 - Sometimes the data feed into our database fails and we lose some dated information, in the example below you can see that the 29th and 30th July are missing. Can the equation be manipulated to look for the most recent previous day, as opposed to just yesterday?

 

Thanks, David

 

kinseld5_1-1691578295118.png

kinseld5_2-1691578471931.png

Swap Completed =
VAR __var1 = 'SRAN Tracker'[radioHB - Sec A Swap]
VAR __var2 = CALCULATE(VALUES('SRAN Tracker'[radioHB - Sec A Swap]), FILTER(ALL('SRAN Tracker'), 'SRAN Tracker'[Date created] = EARLIER('SRAN Tracker'[Date created]) -1 && 'SRAN Tracker'[Nominal] = EARLIER('SRAN Tracker'[Nominal])))
RETURN
IF(ISBLANK(__var2), 0, IF(__var1 = __var2, 0, 1))

 

 

 

2 REPLIES 2
Dhairya
Solution Supplier
Solution Supplier

Hey @Anonymous 
Can you please let me know whether "change" is your column or a measure?
If it is a column then you can use the below measure to calculate "Swap Completed"

Swap Completed = 
IF ( SELECTEDVALUE( 'SRAN Tracker'[Change] ) = "Yes", 0, 1 )

 

Anonymous
Not applicable

 

Your equation will not do what i require unfortunately, i need a change in column 'Change' i.e. from Yes to No to result in a 1 in the 'Swap Completed' column. The equation sent in my original post is a column. Also the the Nominal shown is not the only Nominal in the dataset, i'm just using this as an example.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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