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! Request now

Reply
Anonymous
Not applicable

Data allocation in retailer sales model

Dear PowerBI Community,

 

I'm trying to build a sales model for a company which sell to supermarkets.

The goal is to calculate the net profit made each week, with net profit = Volume Sold x Price - Promotional Costs

 

I'm using 3 tables, each with an example of the dataset:

 

Products

EAN CUNameBrandSegmentFormatPrice
123456Soap BarCleanMeBars400gr0.5
345678XL BarCleanMeBars670gr0.65

 

Sales

EAN CUWeekVolumeValue
12345615.00012.500
34567843.20017.000

 

Promotions

WeekBrandSegmentFormatCost
1CleanMeBarsnull2.000
4nullBars400gr3.500

 

Promotions can be on very specific segments or very broad ones:

  • Line 1 is a promotion on all 'CleanMe Bars' regardless of the size
  • Line 2 is a promotion on all '400gr Bars' regardless of the brand

I can easily link Sales & Products using EAN as a primary key.

 

But I'm struggling to connect the Promotions table:

I believe I should first create a calculated table which splits each promotion into a new row for every product involved.

For instance the promotion on 'CleanMe Bars' would need to be split over the 400gr and 750gr formats:

WeekEANCost
11234561.000
13456781.000

After which I can link the combination Week + EAN to the Sales table.

 

But I don't see how I can create this new table using DAX or PowerQuery. Can somebody help me?

 

Bonus: preferably the cost allocated to each product is weighted according to % of total sales during the specified week)

 

KR,
Thomas

 

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Assuming there will always be an entry (no blanks there) in the Segment column of the Promotions Table, we can first bring over Brand from the Products Table into the Sales Table and then based on Week and Brand columns in the Sales table and Promotion table, we can bring over Cost from the Promotions Table into the Sales Table.

Hope this helps.

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
kentyler
Solution Sage
Solution Sage

I think you should split your promotions table into one table for segment promotions and one for brand promotions. Then each promotion table will have its own relationship and can be linked to sales or products or both...depending on what you want to report on.

 

 

 





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


Anonymous
Not applicable

Unfortunately this wouldn't make my model robust enough:

tomorrow I might want to split my promotions over a different variable (let's say size or flavour) and I would need to change the whole model.

 

What I'm looking for is a solution in Power Query (M language) but I struggle with the language semantics.

 

In pseudo-code I would need the following:

Promotions.AddColumn (list of EAN)

list of EAN = Contract.SelectRows(

if(Promotions.Brand is not null) Contract.Brand == Promotions.Brand 

AND if(Promotions.Segment is not null) Contract.Segment== Promotions.Segment

AND if(Promotions.Format is not null) Contract.Format == Promotions.Format

)

 

Afterwards I can split the List into new Rows using 'Split Columns' and I can continue working on my model

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.

Top Solution Authors
Top Kudoed Authors