Forum Discussion

LD's avatar
LD
Frequent Visitor
6 years ago
Solved

Calculate % in a Col considering Condition

Dear All,

 

Please, I would like to calculate the % of value "Yes" in a colum respect the total of other data.

 

Es.     COL 1

          Yes

          No

          No

          No

          TBD

 

The total count is 5 with 1 Yes; so.... [(1/5) * 100]

 

Thank you

 

LD

  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi LD ,

     

     

    Try this measure

     

    Percent =
    var a = CALCULATE(Count('Table'[COL 1]), KEEPFILTERS('Table'[COL 1] = "YES"))
    var b = COUNTROWS(ALL('Table'))
    RETURN
    DIVIDE(a,b)
     
     
     

    Regards,
    Harsh Nathani

    Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi LD ,

     

     

    Try this measure

     

    Percent =
    var a = CALCULATE(Count('Table'[COL 1]), KEEPFILTERS('Table'[COL 1] = "YES"))
    var b = COUNTROWS(ALL('Table'))
    RETURN
    DIVIDE(a,b)
     
     
     

    Regards,
    Harsh Nathani

    Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)