Forum Discussion
ElvirBotic
Helper III
4 years agoCount Inspections for each Location Once and only Once
I have a dataset where I need to count completed Inspections for each location and count it only once. I will create a table of mock data I am working with. The users will inspect different locations...
johnt75
Super User
4 years agoTry
Total inspections =
var numInspections = CALCULATE( COUNTROWS('Data') )
var inspectionType = SELECTEDVALUE('Data'[Inspection type])
var result = IF( inspectionType = "Long", IF( numInspections > 1, 1, numInspections),
IF( numInspections > 2, 2, numInspections) )
return result
- ElvirBotic4 years ago
Helper III
I tried your approach and when I add the measure to a matrix visual my totals row is 1, which is not correct.
- johnt754 years ago
Super User
Rename the original measure to Individual Inspections and then create a new measure as
Total Inspections = IF( ISINSCOPE( 'Data'[Site]), [Individual Inspections], SUMX( ADDCOLUMNS( SUMMARIZE( 'Data', 'Data'[Site], 'Data'[Type]), "@value", CALCULATE( [Individual Inspections] ), [@value] ) )- ElvirBotic4 years ago
Helper III
I had no luck with this 😞