Forum Discussion

unnijoy's avatar
unnijoy
Post Prodigy
4 years ago
Solved

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 ...
  • Greg_Deckler's avatar
    Greg_Deckler
    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: