Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
GuillaumeL06
Regular Visitor

Counting the number of reference occurences in a list depending a quantity

Hello everyone,

 

I have a column of article references called « Article » and a quantity (column called « Qty ») which counts for each article reference how many article I need. The column « site » refers to the location where the article has to be delivered.

My request is :

I would like to have a column (called "total QTY") with a DAX expression which counts the occurrence number of article depending its quantity. It will be the total quantity for each article reference. For example, for the article «1 », I would like to have a total quantity equals to 7, for article « 2 », I would like to have a total qty equals to 1 etc.

 

Article                  Site                       QTY                      Total QTY

1                           SQY                      5                           7

1                           SAESB                  2                           7

2                           CTC                      1                           1

3                           SQY                      1                           8

3                           SAESB                  5                           8

3                           SAESA                  2                           8

8                           SQY                      1                           2

8                           SAESA                  1                           2

 

 

Thanks for your answers

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@GuillaumeL06 try this measure

 

Total Qty = CALCULATE( SUM(Table[Qty] ), ALLEXCEPT( Table, Table[Article]))


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

2 REPLIES 2
ntaylo06
Resolver II
Resolver II

This probably isn't best practice and probably adds redundant process time, but I have solved similar issues by:

1. Creating a new query based off of the same data source,

2. Removing all columns except what you want to count

3. Adding a calculated column that counts total

4. Creating a relationship with the full query and adding the calculated column to your visual

It makes the column slicerproof and able to be displayed right next to the "sliced" data.

parry2k
Super User
Super User

@GuillaumeL06 try this measure

 

Total Qty = CALCULATE( SUM(Table[Qty] ), ALLEXCEPT( Table, Table[Article]))


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.