Forum Discussion
Anonymous
4 years agoNot applicable
Count Column by Group and filter Part 2.
I am posting a new thread because when I reply with a question about a possible solution, it is removed for Spam. AlexisOlson I need to know how many times a project goes in and out the " Tech ...
- 4 years ago
Ah, I understand what you mean now.
This requires rather different logic we need to incorporate the concept of adjacent rows using the index.
Try this:
New Many = VAR _CurrPID = 'Table'[Project ID] VAR _CurrIndex = 'Table'[Index] VAR _CurrName = 'Table'[Stage_Name] VAR _SubTable_ = FILTER ( 'Table', 'Table'[Project ID] = _CurrPID && 'Table'[Index] >= _CurrIndex && 'Table'[Stage_Name] = "Tech Review" ) RETURN COUNTROWS ( FILTER ( _SubTable_, VAR _NextName = LOOKUPVALUE ( 'Table'[Stage_Name], 'Table'[Project ID], _CurrPID, 'Table'[Index], 'Table'[Index] + 1 ) RETURN _CurrName = "Tech Review" && _NextName <> "Tech Review" ) )
AlexisOlson
4 years agoSuper User
Ah, I understand what you mean now.
This requires rather different logic we need to incorporate the concept of adjacent rows using the index.
Try this:
New Many =
VAR _CurrPID = 'Table'[Project ID]
VAR _CurrIndex = 'Table'[Index]
VAR _CurrName = 'Table'[Stage_Name]
VAR _SubTable_ =
FILTER (
'Table',
'Table'[Project ID] = _CurrPID
&& 'Table'[Index] >= _CurrIndex
&& 'Table'[Stage_Name] = "Tech Review"
)
RETURN
COUNTROWS (
FILTER (
_SubTable_,
VAR _NextName =
LOOKUPVALUE (
'Table'[Stage_Name],
'Table'[Project ID], _CurrPID,
'Table'[Index], 'Table'[Index] + 1
)
RETURN
_CurrName = "Tech Review" && _NextName <> "Tech Review"
)
)
Anonymous
4 years agoNot applicable
It Works! thank you so much