Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin 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.
Hi,
I need add together the items sold based on specified sales code. This is what I currently have, but it is not working. Do I need to create a measure for grouping the sales code first (1000, 2000, etc). And then create a measure for the adding the SUM of the specified sales code.
Hopefully this makes sense. Let me know if you have any questions.
Thanks!
Hi @Bandana_Havana9 ,
Thank you for reaching out to the Microsoft Community Forum.
Hi @KNP and @Ahmed-Elfeel , Thank you for your prompt responses.
Hi @Bandana_Havana9 , Could you please try the proposed solutions shared by @KNP and @Ahmed-Elfeel ? Let us know if you’re still facing the same issue we’ll be happy to assist you further.
Regards,
Dinesh
Hi @Bandana_Havana9 ,
We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. And, if you have any further query do let us know.
Regards,
Dinesh
Hi @Bandana_Havana9 ,
We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. And, if you have any further query do let us know.
Regards,
Dinesh
Hi @Bandana_Havana9,
Your approach is on the right track, but there are a few potential issues with the DAX formula Like:
So I have 3 Solutions for you the 1st approach is (If you have a relationship between tables) :
Total Sold Grouped =
CALCULATE(
SUM('TABLE 1'[PRICE]),
'TABLE 2'[SALES CODE] IN {1000,2000,3000,4000,5000}
)
The 2nd approach Using FILTER (if no direct relationship):
Total Sold Grouped =
CALCULATE(
SUM('TABLE 1'[PRICE]),
FILTER(
'TABLE 2',
'TABLE 2'[SALES CODE] IN {1000,2000,3000,4000,5000}
)
)
Finally the Last approach Using TREATAS (alternative approach):
Total Sold Grouped =
CALCULATE(
SUM('TABLE 1'[PRICE]),
TREATAS({1000,2000,3000,4000,5000}, 'TABLE 2'[SALES CODE])
)
So to answer your questions:
Do you need to create a measure for grouping sales codes first?
Note:Use Option 1 if you have a proper relationship between TABLE 1 and TABLE 2. Use Option 2 if you don't have a direct relationship.
It's difficult to be sure without seeing your model and relationships, but, I would think this syntax should work.
Total Black =
CALCULATE(
SUM(FactInternetSales[SalesAmount])
, FILTER(DimProduct, DimProduct[Color] IN {"Black"})
)
| Have I solved your problem? Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;). |
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 11 | |
| 9 | |
| 8 | |
| 6 | |
| 6 |