SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How to calculate 6 weeks sales prior to starting of fiscal year


How to calculate 6 weeks sales prior to starting of fiscal year

Author
Message
Riyan
Riyan
SSC-Enthusiastic
SSC-Enthusiastic (156 reputation)SSC-Enthusiastic (156 reputation)SSC-Enthusiastic (156 reputation)SSC-Enthusiastic (156 reputation)SSC-Enthusiastic (156 reputation)SSC-Enthusiastic (156 reputation)SSC-Enthusiastic (156 reputation)SSC-Enthusiastic (156 reputation)

Group: General Forum Members
Points: 156 Visits: 6
I want to calculate 6 weeks sales prior to starting of fiscal year.i have date column and a condition

CALCULATE([SALES],

'SIMDate'[WEEKSTART]>=FIRSTDATE('SIMDate'[WEEKSTART],'SIMDate'[PRESENTYEAR]="CURRENT")-42

,'SIMDate'[WEEKSTART]>=FIRSTDATE('SIMDate'[WEEKSTART],'SIMDate'[PRESENTYEAR]="CURRENT")

i am trying to return firstdate of the fiscal year and then subtract 42(which means 6 weeks * 7 days= 42).to get the sales for 6 weeks. but i am not getting any results.
pietlinden
pietlinden
SSC-Forever
SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)

Group: General Forum Members
Points: 43853 Visits: 16090
I think it would be something along the lines of

CALCULATE ( [Total Sales],
DATESBETWEEN(DATEADD("week",-6,Calendar[Date]),Calendar[Date]) )

Riyan
Riyan
SSC-Enthusiastic
SSC-Enthusiastic (156 reputation)SSC-Enthusiastic (156 reputation)SSC-Enthusiastic (156 reputation)SSC-Enthusiastic (156 reputation)SSC-Enthusiastic (156 reputation)SSC-Enthusiastic (156 reputation)SSC-Enthusiastic (156 reputation)SSC-Enthusiastic (156 reputation)

Group: General Forum Members
Points: 156 Visits: 6
In this issue,FISCAL Year is dynamic date which changes every year, usually last sunday of june. For 2015-2016 fiscal year, start date is june 28th,2015. which function i need to use to return first date of fiscal year. i have date column which gives all dates of present fiscal year starting from june 28th,2015. i am trying to pick the first date of fiscal year using FIRST DATE Function then i want to substract 42 days to calculate 6 week sales.

"6 Week sales",
CALCULATE ([SALES],
Filter('SIMDATE',
'SIMDate'[FULLDATE]>=FIRSTDATE('SIMDate'[FULLDATE]-42
&& 'SIMDate'[FULLDATE]<=FIRSTDATE('SIMDate'[FULLDATE]))

Does it works?
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search