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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Cal sale between dates

Hi experts, 

Understand there are numbers of treads related to topic, however, I can't find any to solve my issue. Thank you for any idea and advice. 

bbui_0-1605061276042.png

I want to calculate the total sell-in and sell-out during the OnCounterDate (-6M to +2M) 

My Measure:

(Fcst) Sell-in =
VAR EL = DATEADD(FAST[International OCD],2,MONTH)
VAR SL = DATEADD(FAST[International OCD],-6,MONTH)
RETURN
CALCULATE (
'Sell-in'[Qty Shipped],
FILTER (
'Sell-in',
'Sell-in'[Shipment Date] <= EL
&& 'Sell-in'[Shipment Date] >= SL
)
)
No result for this measure

 

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Anonymous , replace the var with following

VAR EL = DATE(year(FAST[International OCD]),month(FAST[International OCD])+2,day(FAST[International OCD]))
VAR SL = DATE(year(FAST[International OCD]),month(FAST[International OCD])-6,day(FAST[International OCD]))

 

or try rolling with a date tbale

Rolling 6 till next 2 month = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(dateadd(Sales[Sales Date],2,month)),-6,MONTH))

 

or use 8

Rolling 8 till next 2 month = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(dateadd(Sales[Sales Date],2,month)),-8,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

View solution in original post

Anonymous
Not applicable

Hi @amitchandak

Thank for 😀
what is the difference between my DATEADD function and the DATE function you are using. 

 

 

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @Anonymous 

Could show me a sample like your three tables(Sell-In, Sell-Out, Fast)? This may make it easier for me to understand your requirement and measure above.

I think you need to add a value instead of a column in your latest measure.

Due to you use Fast[International OCD] directly in your measure, it shows an error to you.

Can you show me your calculate logic of your measure? What kind of result you want :SUM,AVG,MAX of 

'Sell-in'[Qty Shipped]? You can show me a screenshot of the result you want to me.

Or you can provide me with your pbix file from your Onedrive for Business.

 

Best Regards,

Rico Zhou

 

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

amitchandak
Super User
Super User

@Anonymous , replace the var with following

VAR EL = DATE(year(FAST[International OCD]),month(FAST[International OCD])+2,day(FAST[International OCD]))
VAR SL = DATE(year(FAST[International OCD]),month(FAST[International OCD])-6,day(FAST[International OCD]))

 

or try rolling with a date tbale

Rolling 6 till next 2 month = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(dateadd(Sales[Sales Date],2,month)),-6,MONTH))

 

or use 8

Rolling 8 till next 2 month = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(dateadd(Sales[Sales Date],2,month)),-8,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
Anonymous
Not applicable

I also have an error when using DATE(YEAR,MOTH,DATE)

bbui_0-1605076840302.png

 

Anonymous
Not applicable

Hi @amitchandak

Thank for 😀
what is the difference between my DATEADD function and the DATE function you are using. 

 

 
Anonymous
Not applicable

bbui_0-1605063896182.png

Im not sure where did go wrong. any advice would be greatly appreciated

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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.