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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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))

 

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
v-rzhou-msft
Community Support
Community Support

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))

 

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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