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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Chris_de
Regular Visitor

Dynamic Measure to calculate sales weighted price increase

Hello everyone,

 

I'm working on the following problem already far too long and looking for help now. I have a sales report which is basically structured like this:

Chris_de_3-1685017525321.png

 

I have 70.000 materials with sales data from the years 2017 to 2022. These materials are are assigned to a group structure. Every material has a division, a product main group and a product family. I want to calculate the sales weighted price increase and created my example in Excel first. So I added two columns. Blue is calculating the price. Orange is calculating the price increase based on the year before:

 

Chris_de_2-1685017501883.png

 

In Power BI I created two measures to do the job:

 
Price = DIVIDE(SUM('COPA Sales Portfolio'[turnover]),SUM('COPA Sales Portfolio'[quantity]))

 

Price Increase =

VAR ThisYear = SELECTEDVALUE('COPA Sales Portfolio'[year])

VAR PriceNow = [price]

VAR LastYear= ThisYear - 1

VAR PriceLastYear= CALCULATE([price], 'COPA Sales Portfolio'[year] = LastYear)

 

RETURN

    DIVIDE((PriceNow - PriceLastYear), PriceLastYear)

 

My Problem is the third measure for the sales weighted price increase. In Excel I created this:

Chris_de_4-1685017594454.png

It's basically the Price increase multiplied with the turnover of last year for each material I have selected via filters divided with the total turnover for all selected materials. 

 

So if I select a group or a division or a bunch of specific materials with filters the calculation has to be dynamic. I created various measures but nothing worked correctly and dynamic. Maybe anyone has an idea?

1 REPLY 1
v-jianboli-msft
Community Support
Community Support

Hi @Chris_de ,

 

The formula you provided in the image is generated based on the row number, but there is no row number in the image.

Sorry for that the information you have provided is not making the problem clear to me. Can you please share more details to help us clarify your scenario?

Please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

 

Refer to:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

 

Best Regards,

Jianbo Li

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

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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