Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hello everyone, I'm strugling to create a measure that gives me the sum of quantity that just includes IDs that doesn't have the collection.
In excel I have this table:
A | B | C |
ID | MATERIAL | QUANTITY |
A | COLLECTION | 20 |
B | EXTRA | 78 |
B | COLLECTION | 23 |
C | EXTRA | 9 |
C | COLLECTION | 34 |
D | EXTRA | 90 |
D | COLLECTION | 3 |
E | EXTRA | 11 |
F | EXTRA | 21 |
I need to get the sum of quantity from IDs that just have the EXTRA material. In other words, just the ID E and F in this case.
In excel, I created other table just with E and F in column E, then applied SUM(SUMIFS(C:C;B:B;"EXTRA";A:A;E3:E4)).
Thanks for the help!
Solved! Go to Solution.
Hi @massotebernoull,
How about this:
Here the code:
TomsQuantityMeasure = VAR _helpTable = SUMMARIZE ( Table10, Table10[ID], "CountCollection", CALCULATE ( COUNT ( Table10[ID] ), Table10[MATERIAL] = "Collection" ), "CountExtra", CALCULATE ( COUNT ( Table10[ID] ), Table10[MATERIAL] = "Extra" ) ) RETURN CALCULATE ( SUM ( Table10[QUANTITY] ), FILTER ( _helpTable, [CountCollection] = BLANK() && [CountExtra] >= 1 ) )
Let me know if this helps! 🙂
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! |
#proudtobeasuperuser |
Hi @massotebernoull,
How about this:
Here the code:
TomsQuantityMeasure = VAR _helpTable = SUMMARIZE ( Table10, Table10[ID], "CountCollection", CALCULATE ( COUNT ( Table10[ID] ), Table10[MATERIAL] = "Collection" ), "CountExtra", CALCULATE ( COUNT ( Table10[ID] ), Table10[MATERIAL] = "Extra" ) ) RETURN CALCULATE ( SUM ( Table10[QUANTITY] ), FILTER ( _helpTable, [CountCollection] = BLANK() && [CountExtra] >= 1 ) )
Let me know if this helps! 🙂
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! |
#proudtobeasuperuser |
This one works pretty fine! Nice use of summarize, I never thought about it.
Thanks Tom!!
Hi @massotebernoull ,
Create a measure like below:-
Measure = CALCULATE(SUM('Table'[QUANTITY]),FILTER('Table','Table'[MATERIAL] = "EXTRA"))
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
Thanks for your help Samarth, but your measure will count IDs that also have 'collection' in the Material and I must count just the IDs that doesn't count it
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
105 | |
75 | |
43 | |
39 | |
32 |
User | Count |
---|---|
170 | |
90 | |
65 | |
46 | |
44 |