Forum Discussion

sujatakaran's avatar
sujatakaran
Helper I
5 years ago
Solved

Percentage Calculation with multiple criterias

Hello,   I am looking to create a measure (as I am querying the db and not importing) for the campaign member status. An example data set is pasted below: Campaign Id Member Id Status A1 ...
  • amitchandak's avatar
    5 years ago

    sujatakaran , Try like

    a measure like 

    divide(calculate(count(Table[Campaign]), filter(Table, Table[status] ="Clicked")),calculate(count(Table[Campaign]), filter(Table, Table[status] in {"Open"})))

     

     

  • v-yalanwu-msft's avatar
    5 years ago

    Hi sujatakaran 


    By your description, Your measure may be missing ")" after count().

    Here is the correct one :

    CTR1 =
    DIVIDE (
    CALCULATE (
    COUNT ( 'Table'[Campaign Id] ),
    FILTER ( 'Table', [Status] = "Clicked" )
    ),
    CALCULATE (
    COUNT ( 'Table'[Campaign Id] ),
    FILTER ( 'Table', [Status] IN { "Open", "1-Opened", "2-Open" } )
    ))

    Also, you could create a measure as follows:

    CTR2 =
    COUNTROWS(FILTER('Table',[Status]="Clicked"))
    /COUNTROWS(FILTER('Table',[Status] in {"Open","1-Opened","2-Open"}))

    The final output is shown below:

    Best Regards,
    Community Support Team_ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.