Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

weekly calculation for year to date starting first sunday

Status
Not open for further replies.

ksairam81

Programmer
Mar 20, 2010
1
AU
Hello

I am unable to find a solution for a meaure which need to show weekly calculation year to date starting first sunday on the graph.
For clear understanding as of now we are sitting on todays date , so if we take same time last year to till date and it should be starting with first sunday .
I can get calculated for current year my logic works fine but if i try to do it for year to date my values are not showing correct on the graph

i created start date query item -- _add_years(current_date,-1)
then Day of week --- _day_of_week([StartDate],8)

to get First Sunday --- case when [Day Of Week] = 1
then _add_days([StartDate], 6)
when [Day Of Week] = 2
then _add_days([StartDate],5)
when [Day Of Week] = 3
then _add_days([StartDate],4)
when [Day Of Week] = 4
then _add_days([StartDate],3)
when [Day Of Week] = 5
then _add_days([StartDate],2)
when [Day Of Week] = 6
then _add_days([StartDate],1)
when [Day Of Week] = 7
then [StartDate]
else [StartDate]
end


then date to display on graph --- _add_days([First Sunday],([Common].[dim_date].[cal_week_in_year]-1)*7)

and my filter is calendar date between start date and current date


also as i said for current year it works fine and my logic just need to change Start date --- _add_years(_add_days(current_date,-1*(_day_of_year(current_date)-1)),0)

can anybody plz help me out for the solution

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top