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 All!
I am struggling to group by product with a filter on it.
I would like to create the column "Sum_Apple", having the sum of the Apple price for each customer.
Customer | Product Type | Price | Sum_Apple |
A | Apple | 100 | 300 |
A | Apple | 200 | 300 |
B | Apple | 200 | 200 |
B | Banana | 100 | 200 |
C | Banana | 200 | 0 |
C | Banana | 200 | 0 |
I have been using CALCULATE(SUM(Table[Price],ALLEXCEPT(Table[Customer])), which calculates fine the total price for all products, but in the moment I add the filter (Product = "Apple"), then it only shows the price for each product, not at customer level.
Any suggestion?
Thank you in advance!
Solved! Go to Solution.
Hi @crisxp ,
Please try this:-
Sum_Apple =
CALCULATE (
SUM ( 'Table'[Price] ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[Customer] ),
'Table'[Product Type] = "Apple"
)
) + 0
Output:-
Thanks,
Samarth
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
Try the following it works for me with the data you sent:
Sum_Apple =
CALCULATE (
SUM ( 'Table'[Price] ),
ALLEXCEPT('Table', 'Table'[Customer] ),
'Table'[Product Type] = "Apple"
)
Try the following it works for me with the data you sent:
Sum_Apple =
CALCULATE (
SUM ( 'Table'[Price] ),
ALLEXCEPT('Table', 'Table'[Customer] ),
'Table'[Product Type] = "Apple"
)
Thank you @Samarth_18 , I knew I was getting stucked in something that should be pretty easy. Thanks for your quick solution!!
Hi @crisxp ,
Please try this:-
Sum_Apple =
CALCULATE (
SUM ( 'Table'[Price] ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[Customer] ),
'Table'[Product Type] = "Apple"
)
) + 0
Output:-
Thanks,
Samarth
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
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 |
---|---|
107 | |
100 | |
78 | |
64 | |
58 |
User | Count |
---|---|
148 | |
113 | |
97 | |
84 | |
67 |