Conditional sum

Hello everyone,

I’m trying to make a conditional sum in order to compute the percentage of quota reached.

This is my view :

salesname |   month  | amount |monthly quota
----------------+--------------+--------+--------
Jack            | Oct           |    10       |  100
Jack            | Oct           |    25       |  100
Jack            | Nov          |    45       |  200
Bruce         | Oct           |    60       |  150
Bruce         | Nov          |    60       |  300

I want to create a measure that would find the percentage quota reached like that :
Oct | Nov
Jack 35% | 22,5%
Bruce 40% | 20%

And if I don’t pivot by month :
Jack 26,7%
Bruce 26,7%

So, I think I need to make a conditional sum of the quota for the different month and salesname. I’ve no clue how to undertake that…
Can someone help me ?

Thank you very much in advance.
Grégoire

Perhaps, and it’s just my assumption, you could use sum_distinct on monthly_quota and then sum the amount.

Then if you pivot by Month you should get two measures in each month, the sum of amounts and the quota. From there table calculation to get the %

1 Like

Thanks. I haven’t looked at this measure. Exactly what I was looking for !