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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
zachjudge
Regular Visitor

Combining sales quantities from a bulk item code onto a single unit item code

Hi,

 

I have two seperate item codes for the same exact product, one being the individual unit and the other a bulk amount (usually 10 units).

 

Sales come through as 1 unit sold on both items:

E7tNP8X

When a store reads this, they get confused and think we've had a lot more sales than this which is true.

 

I want to show these sales on the one line so the store knows exactly how many units they have sold, rather than needing to do some manipulation in excel. The order in the bulk amount but I realise it would be tricky to calculate the exact bulk amount sold because stores can often sell on more than one bulk code e.g. x50 and a x10 code which is 3 sale lines for the same product.

 

I have created two columns in the dim_item table that link the bulk item_code to the individual unit code and how many the bulk amount makes up of the individual unit (in this case pack_code is the individual code and the item_code is the bulk amount):

aEzVJgv

 

Any help would be greatly appreciated, even just pointing me in the right direction would be a huge help.

 

Cheers!

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @zachjudge ,

 

Not really getting if you want to pick up 90 units or 9 units but taking into account that you have the information for the pack code and the pack size, taking into account that the item code will have two lines one for 10 units and another with 1 unit you need to make the multiplication/division of the quantities sold by the pack size.

 

I made a very simple model with Items and sales the tables are related by the pack_code.

 

I added the following measure:

TotalSales = 
SUMX (
    ADDCOLUMNS (
        SUMMARIZE ( Sales, Items[pack_code], "Sales", SUM ( Sales[Quantity] ) ),
        "PackSize", CALCULATE ( SELECTEDVALUE ( Items[packsize] ) )
    ),
    [Sales] * [PackSize]
)

 

Has you can see below the calculation is made line by line in the correct way when you have a grouping the calculation continues correct:

MFelix_1-1622636151192.png

Check PBIX file attach.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

1 REPLY 1
MFelix
Super User
Super User

Hi @zachjudge ,

 

Not really getting if you want to pick up 90 units or 9 units but taking into account that you have the information for the pack code and the pack size, taking into account that the item code will have two lines one for 10 units and another with 1 unit you need to make the multiplication/division of the quantities sold by the pack size.

 

I made a very simple model with Items and sales the tables are related by the pack_code.

 

I added the following measure:

TotalSales = 
SUMX (
    ADDCOLUMNS (
        SUMMARIZE ( Sales, Items[pack_code], "Sales", SUM ( Sales[Quantity] ) ),
        "PackSize", CALCULATE ( SELECTEDVALUE ( Items[packsize] ) )
    ),
    [Sales] * [PackSize]
)

 

Has you can see below the calculation is made line by line in the correct way when you have a grouping the calculation continues correct:

MFelix_1-1622636151192.png

Check PBIX file attach.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.