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
LotteLaugesen
Helper V
Helper V

Calculating sum of Sales in a given period

Hi

 

I need to calculate sales per product from Expected selling start date and 4 month ahead.

How do I do that?

I have tried this measure, but it gives me an error.

 
Volume 4 Month =
CALCULATE(SUM('Fact Sales'[Volume]),
USERELATIONSHIP(Dim_Calendar[Date],'New Products'[Expected Selling Start Date]),
DATESBETWEEN(Dim_Calendar[Date],'New Products'[Expected Selling Start Date],DATEADD('New Products'[Expected Selling Start Date],4,MONTH)))
 
Can anybody help me?  I added a link to the test PBI file.
 
Below is a picture of what I would like to get.
 
New Products.JPG

Newbie Lotte 😊
 

 

1 ACCEPTED SOLUTION

I have changed the measure to this:

Volume 4 Month =
CALCULATE(SUM('Fact Sales'[Volume]),
DATESINPERIOD(Dim_Calendar[Date],MIN('New Products'[Expected Selling Start Date]),4,MONTH))
 
And now I get the corrrect result.
Thanks for your help 😊

View solution in original post

6 REPLIES 6
amitchandak
Super User
Super User

@LotteLaugesen , Try this

CALCULATE(CALCULATE(SUM('Fact Sales'[Volume]),
USERELATIONSHIP(Dim_Calendar[Date],'New Products'[Expected Selling Start Date])),
DATESINPERIOD(Dim_Calendar[Date ],Min(Dim_Calendar[Date])+1,4,MONTH) )

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

I have changed the measure to this:

Volume 4 Month =
CALCULATE(SUM('Fact Sales'[Volume]),
DATESINPERIOD(Dim_Calendar[Date],MIN('New Products'[Expected Selling Start Date]),4,MONTH))
 
And now I get the corrrect result.
Thanks for your help 😊
amitchandak
Super User
Super User

@LotteLaugesen , Try like

Volume 4 Month =
CALCULATE(SUM('Fact Sales'[Volume]),
USERELATIONSHIP(Dim_Calendar[Date],'New Products'[Expected Selling Start Date]),
DATESINPERIOD(Dim_Calendar[Date ],Min(Dim_Calendar[Date])+1,4,MONTH) )

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

Thank you for helping, but the measure shows a blank result.

amitchandak
Super User
Super User

@LotteLaugesen , not able to relate your comments with the with data, can you elaborate

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

For each product in New Products file I want sum of Volume from Fact Sales for 4 month after Expected selling start date. I only want to list the products in the New Products file, not any other product sold.

 

For Product100 it should sum volume from Fact Sales from 1st of January to end of 1st of April.

For Product200 it should sum volume from Fact Sales from 2nd of February to end 2nd of May

And so on.. Does this make it more clear?

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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