Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikview979
Specialist
Specialist

Week

Hi Experts,

How can i  get last &first 3 weeks data.


Regards,

Mahesh.

1 Solution

Accepted Solutions
sunny_talwar

Try this:

Temp:

LOAD Max(weeks) - 22 as Max

FROM

WEEKS.xlsx

(ooxml, embedded labels, table is Sheet1);

LET vPick = Peek('Max', 0, 'Table');

DROP Table Temp;

Table:

Directory;

LOAD ID,

    weeks,

    Sales

FROM

WEEKS.xlsx

(ooxml, embedded labels, table is Sheet1)

Where weeks >= $(vPick);

View solution in original post

10 Replies
sunny_talwar

In the script or an expression?

qlikview979
Specialist
Specialist
Author

Hi Sunny,

I have date field,  i need in script level.  please can you share  with expression also.

Regards,

Mahesh.

sunny_talwar

One more question, what do you mean when you say last and first 3 week date? So 3 weeks from beginning or your data and 3 weeks to the end of your data

qlikview979
Specialist
Specialist
Author

Hi Sunny,

3 weeks to the end of my  data.


Regards,

Mahesh.

sunny_talwar

I am not 100% sure I understand, can you share some raw data with the expected output?

qlikview979
Specialist
Specialist
Author

Hi Sunny,

please find my attached file.

Here i want 9-31 dates sales(3 weeks).

Regards,

Mahesh.

sunny_talwar

Try this:

Temp:

LOAD Max(weeks) - 22 as Max

FROM

WEEKS.xlsx

(ooxml, embedded labels, table is Sheet1);

LET vPick = Peek('Max', 0, 'Table');

DROP Table Temp;

Table:

Directory;

LOAD ID,

    weeks,

    Sales

FROM

WEEKS.xlsx

(ooxml, embedded labels, table is Sheet1)

Where weeks >= $(vPick);

qlikview979
Specialist
Specialist
Author

Hi Bro,

Superb ,It 's working perfectly.

I need your one more help  i want to change dynamically  based on date field.

Regards,

Mahesh.

sunny_talwar

This is dynamic based on the date field. This will always bring in the most recent 3 weeks based on the maximum date available in your database