Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

My window function is not working as expected

Hi Team,

I am using the below function to calculate next 2 weeks total for the current week.

I am using windown function it is working fine till the last 2 week but when it comes to week 51 and 52 it shows wrong value even though I have data for next year and but I am using the filter as year.

Evn though if I use year in filter my calculation should count for next week from next year.

Sales_Total_Window = CALCULATE(COALESCE([Sales_Total],0),
WINDOW(1,REL,2,REL,SUMMARIZE(ALLSELECTED('src_horizon v_horizon_aggregate'),'src_horizon v_horizon_aggregate'[YEAR],'src_horizon v_horizon_aggregate'[MONTH],'src_horizon v_horizon_aggregate'[Month_Number],'src_horizon v_horizon_aggregate'[WEEK],'src_horizon v_horizon_aggregate'[Week_Number]),ORDERBY('src_horizon v_horizon_aggregate'[YEAR],ASC,'src_horizon v_horizon_aggregate'[Month_Number],ASC)))/12

 

No Replies