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

Win a FREE 3 Day Ticket to FabCon Vienna. Apply now

Reply
hish
Frequent Visitor

How to calculate the date difference in one column?

Hello everyone, I am quite new to PowerBi. I want to calculate the differnce of t_stamp (i+1) and t_stamp(i). Therefore, I am using the index column and this formula: = Table.AddColumn(#"Hinzugefügter Index", "t_stamp_next", each try #"Dataset 1"{[Index]+1}[t_stamp] otherwise null)

 

Now I want to calculate the difference of t_stamp_next and t_stamp. However, I get the following error message: Expression.Error: A cyclic reference was detected during evaluation. Can someone help me with this issue?

 

hish_0-1745335423415.png

 

1 ACCEPTED SOLUTION

That's not what EARLIER does. In fact, you should unlearn EARLIER. It is no longer a recommended function.

 

Instead use the OFFSET function to access the "prior"  row.

 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.

Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

View solution in original post

6 REPLIES 6
v-venuppu
Community Support
Community Support

Hi @hish ,

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.

Thank you.

v-venuppu
Community Support
Community Support

Hi @hish ,

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

 

lbendlin
Super User
Super User

Now I want to calculate the difference of t_stamp_next and t_stamp

Can you show the code you tried?

 

Note: Things like this may be easier to do with window functions in DAX, or with Visual Calculations.

hish
Frequent Visitor

I tried it with the dax function. I have the following problem. The entries of the column Spalte should be moved one upwards. 

 

hish_0-1745391173008.png

 

hish_1-1745391275118.png

 

 

 

 

That's not what EARLIER does. In fact, you should unlearn EARLIER. It is no longer a recommended function.

 

Instead use the OFFSET function to access the "prior"  row.

 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.

Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Hi @hish ,

I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please accept it as a solution and give it a 'Kudos' so other community members with similar problems can find a solution faster.

Thank you.

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.