Forum Discussion
Time Duration Calculation
- 5 years ago
Hi, ramhariessentia
Please correct me if I wrongly understood your question.
I tried to create a sample by myself based on the information in your screenshot.
The sample pbix file's link is down below.
Total Days Each Project =
VAR currentproject =
MAX ( 'Table'[ProjectID] )
VAR newtable =
SUMMARIZE (
FILTER ( ALL ( 'Table' ), 'Table'[ProjectID] = currentproject ),
'Table'[ProjectID],
"@duration", DATEDIFF ( MIN ( 'Table'[Date] ), MAX ( 'Table'[Date] ), DAY )
)
RETURN
MAXX ( newtable, [@duration] ) + 1https://www.dropbox.com/s/npv905vo4zi4gsk/ramhariessentia.pbix?dl=0
Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
- 5 years ago
Hi,
Thank you for your explanation.
please kindly check the below measure and the link.
I amended the measure to omit < abc-start ~ next of abc-start >
Total Days Each Project =
VAR currentproject =
MAX ( 'Table'[ProjectID] )
VAR abcactivitystartdate =
CALCULATE (
MAX ( 'Table'[Date] ),
FILTER (
ALL ( 'Table' ),
'Table'[ProjectID] = currentproject
&& 'Table'[Activity] = "abc"
)
)
VAR abcactivityfinishdate =
CALCULATE (
MIN ( 'Table'[Date] ),
FILTER (
ALL ( 'Table' ),
'Table'[ProjectID] = currentproject
&& 'Table'[Date] > abcactivitystartdate
)
)
VAR newtable =
SUMMARIZE (
FILTER ( ALL ( 'Table' ), 'Table'[ProjectID] = currentproject ),
'Table'[ProjectID],
"@duration", DATEDIFF ( MIN ( 'Table'[Date] ), MAX ( 'Table'[Date] ), DAY )
)
RETURN
MAXX ( newtable, [@duration] ) + 1
- DATEDIFF ( abcactivitystartdate, abcactivityfinishdate, DAY )https://www.dropbox.com/s/npv905vo4zi4gsk/ramhariessentia.pbix?dl=0
- 5 years ago
What answer are you expecting in the card visual? Does this measure work?
Measure 1 = AVERAGEX(VALUES('Sample data'[Project ID]),[Sample Total Project Time])
Hi, ramhariessentia
Thank you for your feedback.
Terribly sorry that I could not understand your question.
- Now, each Fee Name has a number. Is it a different sample?
- I could not find the Fee name, Design Checking.
- Is the number accumulate duration hours? Or, just a duration of hours?
Hi with reference to your example what if I want to omit activity abc when calculating total duration of project.
with reference to my image for the previous post, those are the actual activity name the numbers are nothing but a split by delimiter
- Jihwan_Kim5 years agoSuper User
Hi,
Thank you for your explanation.
please kindly check the below measure and the link.
I amended the measure to omit < abc-start ~ next of abc-start >
Total Days Each Project =
VAR currentproject =
MAX ( 'Table'[ProjectID] )
VAR abcactivitystartdate =
CALCULATE (
MAX ( 'Table'[Date] ),
FILTER (
ALL ( 'Table' ),
'Table'[ProjectID] = currentproject
&& 'Table'[Activity] = "abc"
)
)
VAR abcactivityfinishdate =
CALCULATE (
MIN ( 'Table'[Date] ),
FILTER (
ALL ( 'Table' ),
'Table'[ProjectID] = currentproject
&& 'Table'[Date] > abcactivitystartdate
)
)
VAR newtable =
SUMMARIZE (
FILTER ( ALL ( 'Table' ), 'Table'[ProjectID] = currentproject ),
'Table'[ProjectID],
"@duration", DATEDIFF ( MIN ( 'Table'[Date] ), MAX ( 'Table'[Date] ), DAY )
)
RETURN
MAXX ( newtable, [@duration] ) + 1
- DATEDIFF ( abcactivitystartdate, abcactivityfinishdate, DAY )https://www.dropbox.com/s/npv905vo4zi4gsk/ramhariessentia.pbix?dl=0
- ramhariessentia5 years agoHelper I
Hi Jihwan,
Is the same formula can be applied in a column
- ramhariessentia5 years agoHelper I
Hi further what if i want to calculate the average time taken for all projects can you send me a formula for that.