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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
NicoLemarchand
Regular Visitor

substract dates and times conditionned to 1 criteria

Hi all, 

 

I'm in trouble with some data I need to compare.

I've a table with some different session_ID and for each I've events with dates (see a sample in screenshot)

 

I want to compare the sessions on stacked timelines (with the same scale) , so I need to set the first event of each session as t=0 and count the time relative to it.

It suppose, for each session, to substract all times with date of 1st event of the session

For the moment, I can only plot the dates on separate timelines, one for each session (see capture).

 

Can you help with that ?

 

I can send you a sample if you want to try something 😉

 

 

screen1.JPGscreen2.JPG

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@NicoLemarchand ,

Based on what I Gor a new column

 

=datediff(minx(filter(Table, [SessionID] =earlier([SessionID]) ), [timestamp]), [timestamp], second)

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

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@NicoLemarchand ,

Based on what I Gor a new column

 

=datediff(minx(filter(Table, [SessionID] =earlier([SessionID]) ), [timestamp]), [timestamp], second)

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

Thank you...

But something went wrong :

 

NicoLemarchand_0-1662371172775.png

 

@NicoLemarchand , hope you are creating a new column in DAX -https://docs.microsoft.com/en-us/dax/datediff-function-dax

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

Sorry, a mistake with a stupid copy/paste without adapt to my data

 

Works perfectly :

 

NicoLemarchand_0-1662371574311.png

Thank you very much !

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.