Forum Discussion
Calculate total based on three conditions
Hi,
I would like to make a calculation for finding the total price based on amount of people.
If count ParticipantID is 0-2500 then 3 USD
and count of ParticipantID 2500-20000 then 4 USD
and count of ParticipantID above 20000 then 5 USD
I have a ParticipntID-field where I can make a count and then the prices are like stated above.
Can someone help me making a measure calculating the total price based on the amount of participants?
Thank you!
Examples below
1st example:
25000 participants then the price would be:
2500 * 3 USD = 7500 USD
17500 * 4 USD = 70000 USD
5000 * 5 USD = 25000 USD
total = 7500 + 70000 + 25000 = 102500 USD
2nd example:
5000 participants then the price would be:
2500 * 3 USD = 7500 USD
2500 * 4 USD = 10000 USD
total = 7500 + 10000 = 17500 USD
Try to create a measure like below:
Measure = var count_ = COUNT('Table'[ParticipantID ]) return SWITCH(TRUE(), count_<=4,count_*3, count_>4&&count_<=10,12+(count_-4)*4, count_>10,36+(count_-10)*5)
3 Replies
- amitchandak
Super User
Anonymous ,
You have create measure like
Comm = Switch(True(),
[Measure] <= 2500 , 3 ,
[Measure] <= 20000 , 4 ,
5)Then at some level you can do product
Prd = sumx(Values([Category]) ,[Measure] *[Comm] )
- AnonymousNot applicable
Hi amitchandak,
Thank you for your response.
I do not have a [Category]. I just have a ParticipantID I make a count of.
So the total is a calculation of the total price based on amount of ParticipantID's.
So I don't get how I should use the 'Prd'-measure.
I hope you can help.
Thank you! 🙂
- V-lianl-msft
Community Support
Try to create a measure like below:
Measure = var count_ = COUNT('Table'[ParticipantID ]) return SWITCH(TRUE(), count_<=4,count_*3, count_>4&&count_<=10,12+(count_-4)*4, count_>10,36+(count_-10)*5)