Forum Discussion
Remove Row context without removing Filter Context
- 5 years ago
Hi Anonymous ,
Please, try the next measure:
latestDate = VAR currStep = MAX ( T[Step] ) RETURN CALCULATE ( MAX ( T[Date] ), FILTER ( ALLSELECTED ( T ), T[Step] = currStep ) )If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.
- 5 years ago
Anonymous ,
You can try this measure instead:
count = VAR _t = FILTER ( ADDCOLUMNS ( SUMMARIZE ( T, T[Step], T[Result], T[Build] ), "@check", VAR maxDatePerStep = CALCULATE ( MAX ( T[Date] ), ALLEXCEPT ( T, T[Step], T[Build] ) ) VAR maxDatePerResult = CALCULATE ( MAX ( T[Date] ) ) RETURN maxDatePerStep = maxDatePerResult ), [@check] = TRUE () ) RETURN COUNTROWS ( _t )If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.
Thank you very much, ERD.
It works. I hadn't understood properly the ALLSELECTED context behaviour.
Now i have another context problem:
My goal with this date is to have a measure for counting PASSED / FAILED results, taking into account only the last execution of the selected builds.
I have a new boolean measure which is:
[Last Result] = [Max Date] = [Last Date]
where Max Date = MAX(Executions[Fecha])
It's working ok at row context level.
But when I'm trying to count all the rows on a context with Last Result = TRUE, the context is not taking the Last Date measure properly (or the Max Date or both).
E.g.: With:
Last Result Count = CALCULATE(COUNTROWS(Executions), FILTER(Executions, [Last Result]))
I obtain for A build 3 FAILED and 3 PASSED, when it should be 3 FAILED and 2 PASSED. Moreover, in the previous table, all the rows display Last Result Count as 1, when no all of them have Last Result = True.
I've trying with:
Last Result Count = COUNTROWS(CALCULATETABLE(Executions, FILTER(Executions, Executions[Date] = [Last Date])))
And it's the same result. Also with SUMX...
I'm trying to understand the context properly, but there is something that i'm missing.
Thank you again.
Best regards
- ERD5 years agoCommunity Champion
Anonymous ,
You can try this measure instead:
count = VAR _t = FILTER ( ADDCOLUMNS ( SUMMARIZE ( T, T[Step], T[Result], T[Build] ), "@check", VAR maxDatePerStep = CALCULATE ( MAX ( T[Date] ), ALLEXCEPT ( T, T[Step], T[Build] ) ) VAR maxDatePerResult = CALCULATE ( MAX ( T[Date] ) ) RETURN maxDatePerStep = maxDatePerResult ), [@check] = TRUE () ) RETURN COUNTROWS ( _t )If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.