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
JeroenHD
Helper I
Helper I

Track date value changes and store new values in table

Hello Team, 

I have a table with a purchase order number, line number and a promised date field. I simplified the table. The original table is refreshed overnight.

This Promised Date is what a supplier provides to inform us when we are about to receive the products.
Over time this date is subject to changes. For example a supplier tells us that goods come in a little later on this new date.


The data comes from SQL database, so i want Power BI to write a changed value in the promised date column to a new column. 

 

We would like to perform analysis on these changes. Not sure if what i'm after is at all possible. 



 

Is this at all possible and does anybody have an idea of how i should pull this off? 
Any direction would be much appreciated!

 

PURC_ORDER_IDLINE_NOPROMISED DATECHANGED DATE 1CHANGED DATE 2CHANGED DATE 3
0010012612021-05-2814-6-2021   
0010012622021-05-2814-6-2021   
003109212021-06-14    
10000112021-07-05    
10000122021-07-05    
10016112021-02-10    
10016122021-02-10    
10018312021-02-1012-02-202114-03-2021  
10018322021-02-1012-02-202114-03-2021  
10018332021-02-1012-02-202114-03-2021  
20130112021-07-20    
20227512021-10-29    
20227522021-10-29    
20283012021-10-29    
20378512021-09-07    
20378612021-11-29    
20378852021-11-29    
20378862021-11-29    
20378872021-11-29    
20378882021-11-29    
20437812021-09-2024-09-202120-10-202123-11-2021 
20463212021-09-07    
20463312021-09-07    
20495512021-01-05    

 

Kind regards,
Jerone

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @JeroenHD 

Power BI is used to analyze data, not create data, it means if data changed in your Data Source, then data in Power BI will also change accordingly after you click on refresh button. So if you want to analyze the difference between them, you need to create a new column or new table in your Data Source.

After you add changes to your datasource, then you can create columns bellow,

CHANGED DATE 1 = 
var _predate=RANKX(FILTER(ALL('Table'),'Table'[LINE_NO]=EARLIER('Table'[LINE_NO]) && 'Table'[PURC_ORDER_ID] = EARLIER('Table'[PURC_ORDER_ID])),'Table'[PROMISED DATE],,ASC)
return IF(_predate=2,'Table'[PROMISED DATE])
CHANGED DATE 2 = 
var _predate=RANKX(FILTER(ALL('Table'),'Table'[LINE_NO]=EARLIER('Table'[LINE_NO]) && 'Table'[PURC_ORDER_ID] = EARLIER('Table'[PURC_ORDER_ID])),'Table'[PROMISED DATE],,ASC)
return IF(_predate=3,'Table'[PROMISED DATE])

result

vxiaotang_0-1640336309567.png

If you need measures, 

measure CHANGED DATE 1 = 
var _predate=RANKX(FILTER(ALL('Table'),'Table'[LINE_NO]=MIN('Table'[LINE_NO]) && 'Table'[PURC_ORDER_ID] = MIN('Table'[PURC_ORDER_ID])),CALCULATE(MIN('Table'[PROMISED DATE])),,ASC)
return IF(_predate=2,MIN('Table'[PROMISED DATE]))
measure CHANGED DATE 2 = 
var _predate=RANKX(FILTER(ALL('Table'),'Table'[LINE_NO]=MIN('Table'[LINE_NO]) && 'Table'[PURC_ORDER_ID] = MIN('Table'[PURC_ORDER_ID])),CALCULATE(MIN('Table'[PROMISED DATE])),,ASC)
return IF(_predate=3,MIN('Table'[PROMISED DATE]))

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-xiaotang
Community Support
Community Support

Hi @JeroenHD 

Power BI is used to analyze data, not create data, it means if data changed in your Data Source, then data in Power BI will also change accordingly after you click on refresh button. So if you want to analyze the difference between them, you need to create a new column or new table in your Data Source.

After you add changes to your datasource, then you can create columns bellow,

CHANGED DATE 1 = 
var _predate=RANKX(FILTER(ALL('Table'),'Table'[LINE_NO]=EARLIER('Table'[LINE_NO]) && 'Table'[PURC_ORDER_ID] = EARLIER('Table'[PURC_ORDER_ID])),'Table'[PROMISED DATE],,ASC)
return IF(_predate=2,'Table'[PROMISED DATE])
CHANGED DATE 2 = 
var _predate=RANKX(FILTER(ALL('Table'),'Table'[LINE_NO]=EARLIER('Table'[LINE_NO]) && 'Table'[PURC_ORDER_ID] = EARLIER('Table'[PURC_ORDER_ID])),'Table'[PROMISED DATE],,ASC)
return IF(_predate=3,'Table'[PROMISED DATE])

result

vxiaotang_0-1640336309567.png

If you need measures, 

measure CHANGED DATE 1 = 
var _predate=RANKX(FILTER(ALL('Table'),'Table'[LINE_NO]=MIN('Table'[LINE_NO]) && 'Table'[PURC_ORDER_ID] = MIN('Table'[PURC_ORDER_ID])),CALCULATE(MIN('Table'[PROMISED DATE])),,ASC)
return IF(_predate=2,MIN('Table'[PROMISED DATE]))
measure CHANGED DATE 2 = 
var _predate=RANKX(FILTER(ALL('Table'),'Table'[LINE_NO]=MIN('Table'[LINE_NO]) && 'Table'[PURC_ORDER_ID] = MIN('Table'[PURC_ORDER_ID])),CALCULATE(MIN('Table'[PROMISED DATE])),,ASC)
return IF(_predate=3,MIN('Table'[PROMISED DATE]))

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@JeroenHD , do want a write back, what is the logic for blue column

 

For write-back you need power app

https://www.youtube.com/watch?v=LxuRzj0X348

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hello Amitchandak, 

Should have explained it better. Which is an art itself it seems:-). 

The data comes from an SQL database. I would like to know that if a date on a row is changed what the new date is compared to the previous entry. 

Does that make any sense?

Kind regards, 
Jeroen

@JeroenHD , there two blog, see if that can help.

https://medium.com/@sam.mckay/show-changes-over-time-in-power-bi-reports-b3e621316cff

https://exceed.hr/blog/how-to-track-changes-in-the-table-in-power-query/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks @amitchandak , will check them out today and let you know. 

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.