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
Anonymous
Not applicable

Revenue calculation for varying dynamic pricing in time periods

Hi all,

 

I have a simple Forecasting-file where we register forecasts as below:

Customer Number

SKU

Units

Forecast Shipping Date

Status

 

This is linked in PowerPivot (though relationships with the date and customer dimension tables) to a pricing table showing the various prices after discounts for different customers, Products (SKUs) and currently Year:

Customer Number

SKU

Price per unit

Year

The formula I use to calculate revenue is pasted at the bottom.

 

Current scenario is that for some customers, the prices are not static for one particular year, and are valid from say, 1st April through 31st March the next year. Consequently, the revenue calculated for Q1 will be incorrect.

My initial thought was to replace the Year column with a Start and End dates, but I am not sure how I would incorporate this into the measure.

How would you set this up?

Measure:

 

Revenue =

VAR Revenue = SUMX (

f_Forecast,

f_Forecast[Units]

* CALCULATE (

MAX ('fAccount Overview'[Price per unit] ),

FILTER (

ALL (

'dAccount Overview'[SKU],

'dAccount Overview'[Customer Number],

'dAccount Overview'[Year]

),

'dAccount Overview'[SKU] = f_Forecast[SKU]

&& 'dAccount Overview'[Customer Number] = f_Forecast[Customer Number]

&& 'dAccount Overview'[Year] = YEAR (f_Forecast[Forecast Shipping Date] )

)

)

)

Return

IF(Revenue=BLANK(),0,Revenue)

 

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi,

 

I have set up tables with dummy data. I cannot share the files, but I hope the tables, relationships and measures below make sense.

 

The idea is that we would need something similar to what's shown in table Account Overview (New Table), where we have a time period where this price is applied.

 

Please see below:

 

Tables

Forecast

NumberCustomerSKUUnitsForecast Shipping Date
1Customer 134288222020-09-15
2Customer 234739292020-05-31
2Customer 2347861252020-04-15
4Customer 4351331152020-10-30
5Customer 534829292020-07-24
7Customer 734317332020-05-18
7Customer 734317512020-06-18
10Customer 1034613932020-08-08
12Customer 1235005992020-06-29
14Customer 1435055102020-09-16
14Customer 14351481182020-10-04
20Customer 2034642622020-07-27
20Customer 2034380232020-04-30
1Customer 1342881242021-04-26
2Customer 234739632021-10-23
2Customer 234786602021-01-15
2Customer 235344712021-11-26
4Customer 435133782021-02-19
14Customer 1434821752021-07-04
15Customer 1534213472021-10-25
19Customer 1935234182021-01-17
20Customer 20345711152021-07-26

 

Customer List

NumberCustomer  
1Customer 1
2Customer 2
4Customer 4
5Customer 5
7Customer 7
10Customer 10
12Customer 12
14Customer 14
20Customer 20
15Customer 15
19Customer 19

 

Account Overview (Original Table)

NumberCustomerSKUPrice per unitYear
1Customer 134288 $           9,490.002020
2Customer 234739 $           7,144.002020
2Customer 234786 $           7,155.002020
4Customer 435133 $              610.002020
5Customer 534829 $           2,334.002020
7Customer 734317 $           1,051.002020
7Customer 734317 $           9,384.002021
10Customer 1034613 $           9,574.002020
12Customer 1235005 $           7,894.002020
14Customer 1435055 $           1,564.002020
14Customer 1435148 $           6,625.002020
20Customer 2034642 $           9,906.002020
20Customer 2034380 $           8,697.002020
1Customer 134288 $           7,533.002021
2Customer 234739 $           5,146.002021
2Customer 234786 $              791.002021
2Customer 235344 $           5,795.002021
4Customer 435133 $           9,960.002021
14Customer 1434821 $           4,647.002021
15Customer 1534213 $           9,488.002021
19Customer 1935234 $           3,232.002021
20Customer 2034571 $           4,284.002021

 

Account Overview (New Table)

NumberCustomerSKUPrice per unitStartEnd
1Customer 134288 $  9,490.001/1/202012/31/2020
2Customer 234739 $  7,144.001/1/202012/31/2020
2Customer 234786 $  7,155.001/1/202012/31/2020
4Customer 435133 $     610.004/1/20203/31/2021
5Customer 534829 $  2,334.004/1/20203/31/2021
7Customer 734317 $  1,051.004/1/20203/31/2021
7Customer 734317 $  9,384.001/1/202012/31/2020
10Customer 1034613 $  9,574.001/1/202012/31/2020
12Customer 1235005 $  7,894.001/1/202012/31/2020
14Customer 1435055 $  1,564.001/1/202012/31/2020
14Customer 1435148 $  6,625.001/1/202012/31/2020
20Customer 2034642 $  9,906.001/1/202012/31/2020
20Customer 2034380 $  8,697.001/1/202012/31/2020
1Customer 134288 $  7,533.001/1/202112/31/2021
2Customer 234739 $  5,146.001/1/202112/31/2021
2Customer 234786 $     791.001/1/202112/31/2021
2Customer 235344 $  5,795.001/1/202112/31/2021
4Customer 435133 $  9,960.004/1/20213/31/2022
14Customer 1434821 $  4,647.001/1/202112/31/2021
15Customer 1534213 $  9,488.001/1/202112/31/2021
19Customer 1935234 $  3,232.001/1/202112/31/2021
20Customer 2034571 $  4,284.001/1/202112/31/2021

 

+ Standard Date Table

 

Relationships

Date[Date] - Forecast[Forecast Shipping Date] (1-to-many)

Customer List[Number] - Forecast[Number] (1-to-many)

Customer List[Number] - Account Overview[Number] (1-to-many)

 

 

Measure

VAR Revenue = SUMX (

Forecast,

Forecast[Units]

* CALCULATE (

MAX ('Account Overview'[Price per unit] ),

FILTER (

ALL (

'Account Overview'[SKU],

'Account Overview'[Number],

'Account Overview'[Year]

),

'Account Overview'[SKU] = Forecast[SKU]

&& 'Account Overview'[Number] = Forecast[Number]

&& 'Account Overview'[Year] = YEAR (Forecast[Forecast Shipping Date] )

)

)

)

Return Revenue

 

Output in pivot table

Revenue  Year 
  20202021
CustomerSKU  
Customer 134288208780934092
Customer 1034613890382 
Customer 1235005781506 
Customer 1434821 348525
 3505515640 
 35148781750 
Customer 1534213 445936
Customer 1935234 58176
Customer 234739207176324198
 3478689437547460
 35344 411445
Customer 2034380200031 
 34571 492660
 34642614172 
Customer 43513370150776880
Customer 53482967686 
Customer 73431788284 

 

Thank you,
Daniel

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.