Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi all,
I have a question. I want to counter the numbers of orders per categorie (Groups[Total amount between]).
I have 2 tables. 1 table is about the sales with the total amounts per order. The other table is about the groupings. An amount of 5.50 falls in the category 5.01 - 7.50 for example. What I want is to count the number of orders per category. So how often have orders been placed in the different categories.
I've been stuck for several days. I only get the total orders....
Here's my data.
I have many rows. This is a small part of the data.
Groupings table
Key | Min | Max | Total amount between |
1 | 0 | 5 | 0 - 5 euro |
2 | 5.01 | 7.50 | 5.01 - 7.50 euro |
3 | 7.51 | 10 | 7.51 - 10.00 euro |
4 | 10.01 | 12.5 | 10.01 - 12.50 euro |
5 | 12.51 | 15 | 12.51 - 15.00 euro |
6 | 15.01 | 17.5 | 15.01 - 17.50 euro |
Sales table:
Only Total amount is relevant in this table.
Key | Order Amount | Donation Amount | Total amount |
.... | .... | .... | 2.50 |
.... | .... | .... | 2.50 |
.... | .... | .... | 2.65 |
.... | .... | .... | 5.50 |
.... | .... | .... | 5.50 |
.... | .... | .... | 7.81 |
.... | .... | .... | 5.50 |
.... | .... | .... | 8.00 |
.... | .... | .... | 8.95 |
.... | .... | .... | 9.00 |
.... | .... | .... | 422.50 |
.... | .... | .... | 424.00 |
What I want:
Total amount between | Count |
0 - 5.00 | 3 |
5,01 - 7,50 | 3 |
7.51 - 10 | 4 |
......... | ......... |
420.01 - 422.50 | 1 |
422.51 - 425.50 | 1 |
My measure now and what I get:
My example Power BI File:
https://www.dropbox.com/s/u0b9tin0u4olb2t/PowerBiToCommunityQuestion2.pbix?dl=0
I hope someone can help me, I have a deadline today.
Solved! Go to Solution.
Hey @Anonymous ,
you should set the min and max as variable. Like this you don't have the confusion with row and filter contexts.
Try the following approach:
Count =
VAR vMin = MIN( Groups[Min] )
VAR vMax = MAX( Groups[Max] )
RETURN
CALCULATE(
COUNTROWS( Sales ),
FILTER(
Sales,
Sales[Total amount] >= vMin && Sales[Total amount] <= vMax
)
)
Hey @Anonymous ,
you should set the min and max as variable. Like this you don't have the confusion with row and filter contexts.
Try the following approach:
Count =
VAR vMin = MIN( Groups[Min] )
VAR vMax = MAX( Groups[Max] )
RETURN
CALCULATE(
COUNTROWS( Sales ),
FILTER(
Sales,
Sales[Total amount] >= vMin && Sales[Total amount] <= vMax
)
)
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
16 | |
13 | |
12 | |
11 | |
11 |
User | Count |
---|---|
19 | |
14 | |
14 | |
11 | |
9 |