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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors