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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
VoltesDev
Helper IV
Helper IV

How DAX calculate process time (cycle time) from log file

Hello guys,

 

When we have a log file that usually contain rows about some changes in our data with the time stamp on it, how are we going to calculate it with DAX for the change time ?

 

Here is what my meaning, I have this kind of table :

 

NameSnapshotDateStepName
New prospect A3/21/2022 10:171-Proposal
New prospect A3/21/2022 10:351-Proposal
New prospect A3/21/2022 23:031-Proposal
New prospect A3/22/2022 23:041-Proposal
New prospect A3/23/2022 23:041-Proposal
New prospect A3/24/2022 23:031-Proposal
New prospect A3/25/2022 23:032-Feedback
New prospect A3/26/2022 23:032-Feedback
New prospect A3/28/2022 23:022-Feedback
New prospect A3/29/2022 23:033-Followup
New prospect A3/30/2022 23:033-Followup
New prospect A3/31/2022 7:363-Followup
New prospect A3/31/2022 23:033-Followup
New prospect A4/1/2022 23:034-Negotiation
New prospect A4/2/2022 23:034-Negotiation
New prospect A4/3/2022 23:034-Negotiation
New prospect A4/4/2022 23:034-Negotiation
New prospect A4/5/2022 23:034-Negotiation
Project 12343/21/2022 10:171-Proposal
Project 12343/21/2022 10:351-Proposal
Project 12343/21/2022 23:031-Proposal
Project 12343/22/2022 23:041-Proposal
Project 12343/23/2022 23:042-Feedback
Project 12343/24/2022 23:032-Feedback
Project 12343/25/2022 23:032-Feedback

 

So I want to calculate the time it took for one project (say New prospect A) when it is on step "1-Proposal", then how much time it took for its next steps.

 

Probably the expected result could be a report look like this :

VoltesDev_0-1649909857049.png

I included my sample PBIX for easier to understand the look of my data in here : https://app.box.com/s/h018q41t7i28bd7ulbk454u6b0vvwmiw

 

Hope anyone can guide me how to build this on DAX language.

 

Thanks,

 

 

1 ACCEPTED SOLUTION

@VoltesDev 
It can be. Sorry I missed that

Duration = 
SUMX ( 
    SUMMARIZE ( 'Log','Log'[name],'Log'[stepname] ),
    CALCULATE ( DATEDIFF ( MIN ('Log'[snapshotdate] ), MAX ('Log'[snapshotdate] ) + 1 , DAY ) )
)

View solution in original post

4 REPLIES 4
tamerj1
Super User
Super User

Hi @VoltesDev 
You can use

Duration = DATEDIFF ( MIN ('Log'[snapshotdate] ), MAX ('Log'[snapshotdate] ) + 1 , DAY )

1.png2.png

Hi @tamerj1 

 

Thank you, this is great! Mind if I ask why the Total cannot be sum up ? I tried in my report also the same as your picture, the grand total for Rows and Column look like still filtered on some of the row. 

Thanks again.

@VoltesDev 
It can be. Sorry I missed that

Duration = 
SUMX ( 
    SUMMARIZE ( 'Log','Log'[name],'Log'[stepname] ),
    CALCULATE ( DATEDIFF ( MIN ('Log'[snapshotdate] ), MAX ('Log'[snapshotdate] ) + 1 , DAY ) )
)

Thank you very much. I've learn a lot from you.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.