Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a document where I want to display the sales figures of previous week.
Example: If today is week 46, then I want to display only the sales of week 45. I don't want the weeks before week 45 displayed.
Can anyone assist on how to write this in the script because after two days I don't seem to find the right way...
The idea is creating a new dimension PreviousWeek which will only display the data for week(Today())-1.
I added an example file.
Many thanks for your assistance
Wim
solved with adding some new code with preceding load which is fantastic!
CheckPreviousWeekFlag:
load
*,
week(Datum)-1 as PreviousWeekNew
where CheckFlagPreviousWeek = 1;
load
*,
if(week(Datum) = week(today())-1,1,0) as CheckFlagPreviousWeek;
Hi
Depending of your example and the table you provide
If you want a dimension
add this in your sript :
weekname(Datum)-1 as Previous_Week
In your table :
add this mesure
above(sum(sales)
Hi Bruno,
Thanks for the information!
It's not exactly the expected result.
1) It's displaying all the weeks instead of one week. I just want one line displayed: Week 45: sum(sales)
2) It's displaying the (last week of the year -1) instead of (current week (46) -1)
3) the totals aren't equal
solved with adding some new code with preceding load which is fantastic!
CheckPreviousWeekFlag:
load
*,
week(Datum)-1 as PreviousWeekNew
where CheckFlagPreviousWeek = 1;
load
*,
if(week(Datum) = week(today())-1,1,0) as CheckFlagPreviousWeek;