Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Hi!
My data-set consists of order rows with order_numers including one or multiple products. I would like to count number of products (items) in each order. I get it to work on total, which means I include all item and are not using any filters. The formula I have used for that is the following:
What I now want to get help with is to calculate above but only include product_category = B.
Expected outcome:
You find some sample data through this link:
https://drive.google.com/file/d/1fIlcHbCpBfh1b-ajGMdmNJBS7Nru4VTY/view?usp=sharing
Please, let me know if any questions - Happy for any support I can get!
Thanks,
Solved! Go to Solution.
[Items per Order (B cat.)] =
var CurrentOrderNumber = Sales[order_number]
return
COUNTX(
filter(
Sales,
Sales[order_number] = CurrentOrderNumber
&&
RELATED( Products[product_category] ) = "B"
),
Sales[product_key]
)In calculated columns in fact tables you should never use CALCULATE.
[Items per Order (B cat.)] =
var CurrentOrderNumber = Sales[order_number]
return
COUNTX(
filter(
Sales,
Sales[order_number] = CurrentOrderNumber
&&
RELATED( Products[product_category] ) = "B"
),
Sales[product_key]
)In calculated columns in fact tables you should never use CALCULATE.
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 64 | |
| 53 | |
| 42 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 121 | |
| 103 | |
| 46 | |
| 30 | |
| 24 |