Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
scenario
based on today() date i want to display last 30 days dates and then i need to divide those 30 days into 4 weeks
that means first seven days into 1 week,2nd 7days into 2nd week like that
thank you
Hi Praveen,
try like this (I'm also a newbie but trying to give answer)
weeks:
LOAD rowno()as row,Date where Date <= (Today()-1) and Date >=(Today()-30);
Load * Inline [
Date
4/25/2015
4/26/2015
4/27/2015
4/28/2015
4/29/2015
4/30/2015
5/1/2015
5/2/2015
5/3/2015
5/4/2015
5/5/2015
5/6/2015
5/7/2015
5/8/2015
5/9/2015
5/10/2015
5/11/2015
5/12/2015
5/13/2015
5/14/2015
5/15/2015
5/16/2015
5/17/2015
5/18/2015
5/19/2015
5/20/2015
5/21/2015
5/22/2015
5/23/2015
5/24/2015
5/25/2015
5/26/2015
5/27/2015
5/28/2015
5/29/2015
5/30/2015
5/31/2015
6/1/2015
6/2/2015
6/3/2015
6/4/2015
6/5/2015
6/6/2015
6/7/2015
6/8/2015
];
load Date,If(row < 8,'W1',If(row < 15, 'W2', If(row < 22, 'W3', If(row < 29 ,'W4','W5')))) as Week resident weeks;
drop table weeks;
thank you but i dont want to write all these dates insted of inline i want to display all 30 days by using script
i need script for display last 30 days dates based on today() date
Something like:
LOAD
Date,
Ceil(Index / 7) As Week
;
LOAD Date(Today() - 31 + RecNo()) As Date,
RecNo() As Index
AutoGenerate 30;
Hello Praveen,
Just check if this is of any help.
Thanks,
V.
Hi,
See the attached.
Is it what you are looking for?
You can use a pivot tables, add 2 dimensions to row:
1. Week
2. Date
To just load 30 most recent days, you have 2 choices:
- Set analysis on Measure
- Use if condition to return 0 or null(0 for date before last 30 days, such as:
sum(if(DateField - WeekStart(today(),-4,0) > 0, CalculationField, 0))
and set Dont show null value on dimensions