Forum Discussion
Measure Optimization Help
Aha! Thanks Stachu, I appreciate the specific suggestion. I've just started changing the code over to use CALCULATE(COUNTA() instead of COUNTAX(FILTER() and it appears the time to load after a slicer change has already improved. I'll follow up once I have all the code changed.
Another question - I'm calculating population statistics to compare to the sliced stats, like this:
Population Rough Total Failures = COUNTX(FILTER(ALL(RoughInspections_merged), RoughInspections_merged[RoughAirBarrier.CantileverAirBarrier]="Fail"), RoughInspections_merged[RoughAirBarrier.CantileverAirBarrier])
Any suggestion for how to rework/optimize this using the pattern that Stachu suggested? CALCULATE(COUNTA(...
I've tried this but it's clearly not right:
CALCULATE(COUNTA(ALL(RoughInspections_merged[RoughAirBarrier.CantileverAirBarrier])), ALL(RoughInspections_merged[RoughAirBarrier.CantileverAirBarrier]="Fail"))
- Stachu7 years ago
Community Champion
if you add ALL inside COUNTA it counts all
CALCULATE ( COUNTA ( RoughInspections_merged[RoughAirBarrier.CantileverAirBarrier] ), FILTER ( ALL ( RoughInspections_merged[RoughAirBarrier.CantileverAirBarrier] ), RoughInspections_merged[RoughAirBarrier.CantileverAirBarrier] = "Fail" ) )- jscottNRG7 years ago
Helper II
Thanks Stachu. I believe I entered that measure as you suggested and it appears it's still being affected by slicer selections. I was hoping for something that is unaffected by slicers. Any thoughts?
- jscottNRG7 years ago
Helper II
I figured that last issue out, the DAX needed to be this way to get a count unaffected by slicers:
CALCULATE(COUNTA(RoughInspections_merged[RoughAirBarrier.CantileverAirBarrier]), FILTER(ALL(RoughInspections_merged), RoughInspections_merged[RoughAirBarrier.CantileverAirBarrier] = "Fail"))
Note that inside the ALL() function is the entire "RoughInspections_merged" table, not a specific column in that table.