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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
stsdrillingeng3
Frequent Visitor

Offset column with a date

Hello everybody,

here is my problem :
I'm trying to offset a column so that i can have the time between operations (in powerbi dax)
the thing is that i can do it with numbers but i dont know why i can't do it with text.
Can someone help me do it please ?
Here is a exemple of a table that i have ( the data is not real) with an added offset colum that i want to code via DAX

stsdrillingeng3_0-1695395640941.png

 

Thanks in advance

1 ACCEPTED SOLUTION
some_bih
Super User
Super User

Hi @stsdrillingeng3 possible solution is calculated column as below. Adjust Sheet1 to your table name.

This solution assumes that column ID is unique value to identify row for end date.

 

Offset formula =
VAR __current_id=Sheet1[id]
RETURN  
CALCULATE(
    MAX(Sheet1[end_date]),
    FILTER(Sheet1,
    Sheet1[id]=__current_id-1)
)
 
Output
some_bih_0-1695565810649.png

Did I answer correctly? Kudos appreciate / accept solution.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






View solution in original post

2 REPLIES 2
some_bih
Super User
Super User

Hi @stsdrillingeng3 possible solution is calculated column as below. Adjust Sheet1 to your table name.

This solution assumes that column ID is unique value to identify row for end date.

 

Offset formula =
VAR __current_id=Sheet1[id]
RETURN  
CALCULATE(
    MAX(Sheet1[end_date]),
    FILTER(Sheet1,
    Sheet1[id]=__current_id-1)
)
 
Output
some_bih_0-1695565810649.png

Did I answer correctly? Kudos appreciate / accept solution.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Yeas it works perfectly thanks a lot ! I tried using the offset formula but yours is so much more easier and comprehensible.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.

Top Solution Authors