Forum Discussion
How Do I Calculate Project Activity Back and Forth
- 4 years ago
Hi Anonymous ,
Reaching this is more difficult. You can try the following steps.
First create an index column.
Create a calculated column to calculate the number of times the current row belongs to tech review.How many times = VAR _maxIndexOf_ProjectAndStage = MAXX ( FILTER ( 'Table', 'Table'[ProjectId] = EARLIER ( 'Table'[ProjectId] ) && [Stage_Name] = "Tech Review" ), [Index] ) VAR _maxIndexOfProject = MAXX ( FILTER ( 'Table', 'Table'[ProjectId] = EARLIER ( 'Table'[ProjectId] ) ), [Index] ) VAR _countNotTechReview = COUNTROWS ( FILTER ( 'Table', [Index] > EARLIER ( 'Table'[Index] ) && [Stage_Name] <> "Tech Review" ) ) RETURN IF ( [Stage_Name] = "Tech Review", _countNotTechReview - ( _maxIndexOfProject - _maxIndexOf_ProjectAndStage - 1 ) )
Create another column to calculate how many days the current tech review has consumed.length of XXX calendar days = VAR _start = MAXX ( FILTER ( 'Table', [ProjectId] = EARLIER ( 'Table'[ProjectId] ) && [How many times] = EARLIER ( 'Table'[How many times] ) ), [Created] ) VAR _end = MINX ( FILTER ( 'Table', [ProjectId] = EARLIER ( 'Table'[ProjectId] ) && [How many times] = EARLIER ( 'Table'[How many times] ) ), [Created] ) RETURN IF ( [Stage_Name] = "Tech Review", VALUE ( _start - _end ) + 1 )Finally, in the visual chart, seperate the maximum number of times for the current project id and average the number of days using the following formula.
average length of XXX calendar days = AVERAGEX(VALUES('Table'[length of XXX calendar days]),[length of XXX calendar days])Pbix in the end you can refer.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I need to know how many times a project has to have the same step repeated in the production process.
I am trying to get to the level that says:
Tech review had to be started 6 seperate times. Each instance had an average length of XXX calendar days.
Hi Anonymous ,
Reaching this is more difficult. You can try the following steps.
First create an index column.
Create a calculated column to calculate the number of times the current row belongs to tech review.
How many times =
VAR _maxIndexOf_ProjectAndStage =
MAXX (
FILTER (
'Table',
'Table'[ProjectId] = EARLIER ( 'Table'[ProjectId] )
&& [Stage_Name] = "Tech Review"
),
[Index]
)
VAR _maxIndexOfProject =
MAXX (
FILTER ( 'Table', 'Table'[ProjectId] = EARLIER ( 'Table'[ProjectId] ) ),
[Index]
)
VAR _countNotTechReview =
COUNTROWS (
FILTER (
'Table',
[Index] > EARLIER ( 'Table'[Index] )
&& [Stage_Name] <> "Tech Review"
)
)
RETURN
IF (
[Stage_Name] = "Tech Review",
_countNotTechReview - ( _maxIndexOfProject - _maxIndexOf_ProjectAndStage - 1 )
)
Create another column to calculate how many days the current tech review has consumed.
length of XXX calendar days =
VAR _start =
MAXX (
FILTER (
'Table',
[ProjectId] = EARLIER ( 'Table'[ProjectId] )
&& [How many times] = EARLIER ( 'Table'[How many times] )
),
[Created]
)
VAR _end =
MINX (
FILTER (
'Table',
[ProjectId] = EARLIER ( 'Table'[ProjectId] )
&& [How many times] = EARLIER ( 'Table'[How many times] )
),
[Created]
)
RETURN
IF ( [Stage_Name] = "Tech Review", VALUE ( _start - _end ) + 1 )
Finally, in the visual chart, seperate the maximum number of times for the current project id and average the number of days using the following formula.
average length of XXX calendar days =
AVERAGEX(VALUES('Table'[length of XXX calendar days]),[length of XXX calendar days])
Pbix in the end you can refer.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous4 years agoNot applicable
This is Great! How woudl I change the index columns so that its not specific to "Tech Review". I want to make sure I am capturing the all of the different Stages
- Anonymous4 years agoNot applicable
Could you help me with what you mean by create an "Index Column"? Thank you
- v-chenwuz-msft4 years ago
Community Support
- Anonymous4 years agoNot applicable
Thank you for this. I was able to group and index all of the projects. I reposted my question with a new issue that is coming up in "how many times" column. It is under the question
"Count Column by Group and filter"
https://community.powerbi.com/t5/Desktop/Count-Column-by-Group-and-filter/m-p/2473373#M881651
Maybe you could take a look at this new issue. I think it is almost solved! Thank you again!