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!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi everybody. This might be a simple calculation, but I'm sort of new to Power BI and need help.
I have a table like this, with a batch, part, and batch size. A batch might have several parts, but the Batch Size is always the same.
I'm trying to sum the total Batch Size, but I want the sum to only sum distinct values of Batch, something like this:
How can I calculate a measure with this total in Power BI?
Thanks!
Solved! Go to Solution.
Hi @slofish
You can create several measures as follow:
Measure = RIGHT(MAX([Part]), 2)rank = RANKX(ALLEXCEPT('Table', 'Table'[Batch]), [Measure], , DESC, Dense)min = MINX(ALLEXCEPT('Table', 'Table'[Batch]), [rank])sum = CALCULATE(SUM('Table'[Batch Size]), FILTER('Table',[rank] = [min]))
Output:
Best Regards,
Yulia Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @slofish
You can create several measures as follow:
Measure = RIGHT(MAX([Part]), 2)rank = RANKX(ALLEXCEPT('Table', 'Table'[Batch]), [Measure], , DESC, Dense)min = MINX(ALLEXCEPT('Table', 'Table'[Batch]), [rank])sum = CALCULATE(SUM('Table'[Batch Size]), FILTER('Table',[rank] = [min]))
Output:
Best Regards,
Yulia Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!