Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Count the last day of the week registered

Hello,

I am new on Qlik Sense and  If anyone can help me with the following situation:

I have the following table:

WeekDateAmount
2016/3101-08-20161219
2016/3031-07-20161205
2016/3030-07-2016905
2016/3029-07-2016755
2016/3028-07-2016640
2016/3027-07-20161355
2016/3026-07-20161548
2016/3025-07-20161520
2016/2924-07-20161520
2016/2923-07-20161357
2016/2922-07-20161049
2016/2921-07-20161005
2016/2920-07-2016697
2016/2919-07-2016654
2016/2918-07-2016249
2016/2815-07-2016246

Where the amount field is a Count (distict  ID_pallet). I need to count the quantities for weeks for the last day on record of each week. I mean:

WeekDateAmount
2016/3101-08-20161219
2016/3031-07-20161205
2016/2924-07-20161520
2016/2815-07-2016246

I can't do it directly on the script because i also need the day for other analysis.

Beforehand thank you very much.

5 Replies
MVP
MVP

Re: Count the last day of the week registered

May be like this:

Week as dimension:

Expression:

Sum(If(Date = WeekEnd(Date), Amount))

MVP
MVP

Re: Count the last day of the week registered

Or may be using this script, create flags:

Table:

LOAD "Week",

    "Date",

    Amount

FROM [lib://Lib]

(html, codepage is 1252, embedded labels, table is @1);

FinalTable:

LOAD *,

  If("Week" <> Previous("Week"), 1, 0) as Flag

Resident Table

Order By "Date" Desc;

DROP Table Table;

And then a table like this:

Dimension:

Week

Date

Expression:

Sum({<Flag = {1}>}Amount)

Capture.PNG

Not applicable

Re: Count the last day of the week registered

Thanks Sunny, but i have a problem with this method because in the last week ( this week) i have to show the last day available, for example for this week i have to show  today amount and i dont have a change of week in this case.  Can you help me?

MVP
MVP

Re: Count the last day of the week registered

If you reload the application today with today's data in it, then the flag will be reassigned to today's date. Have you tried reloading with new data?

Not applicable

Re: Count the last day of the week registered

Yes, you are right! thank you very much

Community Browser