Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi Guys,
I am currently stuck with the COUNT function on power bi. I need help!
I need to count the number of customer name with an average billed amount of :
< 45
>45 and <=55
>55 and <=100
>100 and <= 200
>200
Total billed amount, count of orders, and average billed amount are measures I created.
please help!!! Thank you.
Solved! Go to Solution.
It depends on whether you need the calculation for average billed amount to be affected by slicers and filters, e.g. date range. If you don't need that then you could create a calculated column on the customer table like
Average billed group =
var billedAmount = [Average billed amount]
return SWITCH ( TRUE(),
billedAmount <= 45, "<= 45",
billedAmount > 45 && billedAmount <= 55, "> 45 and <= 55",
billedAmount > 55 && billedAmount <= 100, "> 55 and <= 100",
billedAmount > 100 && billedAmount <= 200, "> 100 and <= 200",
"> 200"
)
but if you need to take into account slicers and filters then you would need to create a separate measure for each range, something like
Avg billed less than 45 = COUNTROWS( FILTER( Customer, [Average billed amount] <= 45 ) )
Yes, the count should be updated by the slicers.
Hi, @Andrew_na_lang
What related fields do you apply to slicers?
Can you share relevant screenshots?
Best Regards,
Community Support Team _ Eason
I use this
Avg billed less than 45 = COUNTROWS( FILTER( Customer, [Average billed amount] <= 45 ) )
It depends on whether you need the calculation for average billed amount to be affected by slicers and filters, e.g. date range. If you don't need that then you could create a calculated column on the customer table like
Average billed group =
var billedAmount = [Average billed amount]
return SWITCH ( TRUE(),
billedAmount <= 45, "<= 45",
billedAmount > 45 && billedAmount <= 55, "> 45 and <= 55",
billedAmount > 55 && billedAmount <= 100, "> 55 and <= 100",
billedAmount > 100 && billedAmount <= 200, "> 100 and <= 200",
"> 200"
)
but if you need to take into account slicers and filters then you would need to create a separate measure for each range, something like
Avg billed less than 45 = COUNTROWS( FILTER( Customer, [Average billed amount] <= 45 ) )
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
105 | |
96 | |
75 | |
63 | |
62 |
User | Count |
---|---|
137 | |
105 | |
104 | |
80 | |
63 |