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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Sandeep_PowerBI
Frequent Visitor

Date Diff calc from one field current cell to previous field cell

Hi Team,

 

Good Day!

I need to calculate the Running time of vehicle for 2 date fields (Notify Date & Complete Date). Below is the reference screenshot. I have to show same for all the vehicles in individual months (Jan 31 days; Feb 28 days; Mar 31 days; Apr 30 days etc.,)

Eg: Each monthb (Jan - Start: 01/01/2023 12:00 AM to End: 31/02/2023 11:59 PM), Need to calc running days for each month.

 

This is Actual table available:

Sandeep_PowerBI_0-1683577219744.png

Need O/p:

Sandeep_PowerBI_1-1683577371868.png

Calculated in Excel; How to do it same in Power BI?

Sandeep_PowerBI_2-1683577538946.png

 

Kindly help with the DAX command to calc the Running time?

Thank you!

 

Regards,

Sandeep

 

 

1 REPLY 1
Mahesh0016
Super User
Super User

@Sandeep_PowerBI 

Sales Amount = SUM(Table[Running Time(Days)])
****************************************

Sales RT :=
VAR MaxDate = MAX ( 'Date'[Date] ) 
RETURN
    CALCULATE (
        [Sales Amount],           
        'Date'[Date] <= MaxDate,  
        ALL ( Date )    ,
         ALLEXCEPTE(Table,Table[Car No])
    )

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.