cancel
Showing results for
Did you mean:

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Helper III

## Sum quantity per partcode

Hello,

I'm struggling with the sum of quantities per partnumber. Our machines have framenumbers and those machines are build with parts. I would like to sum the parts in an overview.

This is the data:

 Framenumber PartNumber Quantity 01504M 112455 2 01504M 238574 22 01504M 598749 5 01504M 254875 4 01504M 254152 11 01504M 658745 23 01504M 158965 1 01504M 128544 45 01504M 123659 7 01504M 128588 9 01504M 124588 2 01605D 112455 2 01605D 238574 22 01605D 598749 5 01605D 254875 4 01605D 254152 11 01605D 658745 23 01605D 158965 1 01605D 128544 45 01605D 123659 7 01605D 128588 9 01605D 124588 2 07822E 112455 2 07822E 238574 22 07822E 598749 5 07822E 254875 4 07822E 254152 11 07822E 658745 23 07822E 158965 1 07822E 128544 45 07822E 123659 7 07822E 128588 9 07822E 124588 2

And the result should look like this:

 PartNumber Quantity 112455 6 238574 66 598749 15 254875 12 254152 33 658745 69 158965 3 128544 135 123659 21 128588 27 124588 6 112455 6 238574 66 598749 15 254875 12 254152 33 658745 69 158965 3 128544 135 123659 21 128588 27 124588 6

I tried this but it seems that the total QTY is summed and multiplied by three:

Total_QTY_per_PartNumber = CALCULATE(SUM(ProductionPartAll[Quantity]), ALLEXCEPT(ProductionPartAll, ProductionPartAll[PartNumber]))

Can someone help me out?

1 ACCEPTED SOLUTION
Community Champion

oh okay @WLFRD , then try this:-

``````Column =
CALCULATE (
SUM ( 'ProductionPartAll'[Quantity] ),
FILTER (
'ProductionPartAll',
'ProductionPartAll'[PartNumber] = EARLIER ( 'ProductionPartAll'[PartNumber] )
)
)``````

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

7 REPLIES 7
Community Champion

Hi @WLFRD ,

You can directly drag your partnumber and Quantity column then mark Quantity column summerization as Sum.

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.

Helper III

Thanks! But I would like to have a calculated column. I need this total column for another calculation.

Community Champion

oh okay @WLFRD , then try this:-

``````Column =
CALCULATE (
SUM ( 'ProductionPartAll'[Quantity] ),
FILTER (
'ProductionPartAll',
'ProductionPartAll'[PartNumber] = EARLIER ( 'ProductionPartAll'[PartNumber] )
)
)``````

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Helper III

Is it possible to make the calculation dynamic? I mean, based on how we filter the data, it has to calculate the sum per PartNumber.

Super User

what result are you getting?  can you share?

I get this result from your measure

If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!

Helper III

Is it possible to make the calculation dynamic? I mean, based on how we filter the data, it has to calculate the sum per PartNumber.

Helper III

This is my result in Power BI:

 PartNumber Total_QTY_Per_PartNumber 128544 405 658745 207 238574 198 254152 99 128588 81 123659 63 598749 45 254875 36 112455 18 124588 18 158965 9

Announcements

#### Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

#### Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

#### The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors