Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dimension- Dates buckets

Hi All,

Good day!..

can anyone help me? I am looking for multiplete buckets with same date in Dimesnsion

Like -

Last Week (0-7 days)

Last week -1 (7-14 days)

Last Month (0-30 days)

Last Month -1 (30-60 days)

Please help on this.

thasnks

4 Replies
ahaahaaha
Partner - Master
Partner - Master

Hi Vikas,

Look here https://www.resultdata.com/qlik-custom-calendars/

Regards,

Andrey

Not applicable
Author

Hi Sir,

Thank you for the reaply, but I have a filed in my data set which contans date (let say daty wise sale). Now i want to show Last week, last week -1 ,current month, Last month sale.

Please suggest.

Anil_Babu_Samineni

Try this in Script

Sample:

Load * Inline [

DateField, Sales

Today(), 10

Today()-1, 20

Today()-2, 30

Today()-3, 40

Today()-4, 50

];


Cale:

Load DateField, Sales, Week(DateField) as Week, Month(DateField) as Month,

If(Week = Max(Week-1), Dual('Last Week',1),

If(Week = Max(Week-2), Dual('Last Week - 1',2),

If(Month = Max(Month), Dual('Current Month',3),

If(Month = Max(Month-1), Dual('Last Month Sale',4))))) as [Dates Buckets]

Resident Sample;

Drop Table Sample;

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
ahaahaaha
Partner - Master
Partner - Master

The link above has a line of code

IntervalMatch ([start_date])


[start_date] - this is the field of "Date". You have insert to the script in the link proposed a code snippet, replacing [start_date] on your field name of date. Further on the list you must create a listbox and use it in the field [Date Range].


When you load the script in the variable v_today writes the current date. Selections are performed in the list. The desired ranges of selections you can add or change the code.


Regards,

Andrey