Forum Discussion
unnijoy
4 years agoPost Prodigy
Sum based on filter
I have a survay data. I need to find the positive %. So in the Positive column we will be counting the total 1. and that count should be divided by total distinct dount of ID. and for 2021 i have to ...
- 4 years ago
Measure = VAR __Table = FILTER('Table',[year]=2021) VAR __Denominator = COUNTROWS(DISTINCT(SELECTCOLUMNS(__Table,"ID",[ID]))) VAR __Numerator = COUNTROWS(DISTINCT(SELECTCOLUMNS(FILTER(__Table,[Positive]=1),"ID",[ID]))) RETURN DIVIDE(__Numerator,__Denominator,0)unnijoy Try:
unnijoy
4 years agoPost Prodigy
hi Greg_Deckler , as per the above table the expected result is as follows.
positive = 2
total dist count of id = 3. as u can see that the for the third guy positive is coming as 0 but still we need to count him.
Positive % = 2/3= 67 %
Greg_Deckler
4 years agoCommunity Champion
Measure =
VAR __Table = FILTER('Table',[year]=2021)
VAR __Denominator = COUNTROWS(DISTINCT(SELECTCOLUMNS(__Table,"ID",[ID])))
VAR __Numerator = COUNTROWS(DISTINCT(SELECTCOLUMNS(FILTER(__Table,[Positive]=1),"ID",[ID])))
RETURN
DIVIDE(__Numerator,__Denominator,0)
unnijoy Try: