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
bjpowell93
Frequent Visitor

Creating a Non-Volatile TODAY() function in New Column

Hi all,

 

I have a dataset that will be refereshed regularly and contains c.450,000 rows of individual products. In each row are a series of pass/fail criteria in different columns. Once all of the criteria say "pass", a status column updates to say "pass", indicating there are no fails in the criteria. 

 

What I would like, is a new column that states the date on which the status column updated to say "pass". 

 

I have tried using the TODAY() function, but because it's volatile it doesn't stay fixed because I don't want this newly input date to roll-on, rather be fixed to the date the status changed. 

 

I'm not sure whether this is best tackled by simply adding a new column and inputting a formula, or whether it should be a conditional column, custom column, or done by invoking a custom function. 

 

Any solutions would be hugely appreciated!!

 

Many thanks!

2 ACCEPTED SOLUTIONS
v-chenwuz-msft
Community Support
Community Support

Hi @bjpowell93 ,

 

No, power bi is sent query to data source to get data then calculate. If you refresh, it will refresh the whole data, so the calculation result won't be saved. It means you can not keep the date created by today()

 

You can try add the date in original data source or maybe you can try python script in power bi query, run python script to save the date then power bi get data from the python script result.

Run Python Scripts in Power BI Desktop - Power BI | Microsoft Docs

 

Best Regards

Community Support Team _ chenwu zhu

 

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

View solution in original post

Hi @bjpowell93 ,

 

Fill the date with the formula in the power query.

vchenwuzmsft_2-1647400409979.png

Add custom column to fill which row has no date.

vchenwuzmsft_0-1647400198758.png

 

Then the resulting result is rewritten to the file. I use the .csv file format here.

 

vchenwuzmsft_1-1647400245364.png

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

View solution in original post

8 REPLIES 8
v-chenwuz-msft
Community Support
Community Support

Hi @bjpowell93 ,

 

No, power bi is sent query to data source to get data then calculate. If you refresh, it will refresh the whole data, so the calculation result won't be saved. It means you can not keep the date created by today()

 

You can try add the date in original data source or maybe you can try python script in power bi query, run python script to save the date then power bi get data from the python script result.

Run Python Scripts in Power BI Desktop - Power BI | Microsoft Docs

 

Best Regards

Community Support Team _ chenwu zhu

 

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

Hi @v-chenwuz-msft,

 

Thanks for these ideas - do you know what the Python script would look like?

 

Using Python isn't something I'vr done before. 

 

Thanks!

Hi @bjpowell93 ,

 

Fill the date with the formula in the power query.

vchenwuzmsft_2-1647400409979.png

Add custom column to fill which row has no date.

vchenwuzmsft_0-1647400198758.png

 

Then the resulting result is rewritten to the file. I use the .csv file format here.

 

vchenwuzmsft_1-1647400245364.png

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

amitchandak
Super User
Super User

@bjpowell93 , add in power query

Date.From(DateTime.FixedLocalNow())

 

https://www.enhansoft.com/how-to-add-the-last-refreshed-date-and-time-to-a-power-bi-report/

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

Hi @amitchandak,

 

Unfortunately, when I've refreshed my report today with Date.From(DateTime.FixedLocalNow()), the date has now changed to today's date, not stayed at yesterday's date. 

 

Do you know why this is? 

@amitchandak 

 

Would this be correct ("RFM Pass/Fail" is the status column):

 

if [#"RFM Pass/Fail"] is Pass then Date.From(DateTime.FixedLocalNow()) else null

To clarify, what I'd need is a date the status changed to "pass" upon a daily refresh, input in a new "Date Status Pass" column for every product row. Any that don't have a status of "pass" will be left blank in this new date column.

So, create a new column in power query - is this a custom column this would be input into?

 

To double-check, the next time the data is refreshed, the newly input date wouldn't change?

 

How do I integrate this Date.From(DateTime.FixedLocalNow()) function into an IF statement for the status changing to "pass"? 

 

I can't see "IF" as an option for a custom column.

 

Thanks!

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.