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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Show only several last weeks

Hi everyone,

I have historical data. I created chart with cyclic group (Week and Month).

I want to create some conditions, which show all data by Month and only dynamically last 12 weeks.

Do you have any ideas?

Thanks,

26 Replies
Not applicable
Author

Vladimir,

You can use it how you want. But now you have also a solution where you can let the user select number of weeks (days).

Can you mark my solution as correct please!

Greetings,

Marc

Anonymous
Not applicable
Author

I do the same only for Months variable.

See my attached file. I want to select for example last 3 months. I have no idea how swith to month level, not by dates.

count({<MYear={">=$(=Date(MonthName(max(MYear))-45))"},[qID_3_Task completion]={'Yes'}>}[qID_3_Task completion])/

Count({<MYear={">=$(=Date(MonthName(max(MYear))-45))"}>}TOTAL <MYear> [qID_3_Task completion])

I don't want to calculate which month has 30 days or 31 days.

Maybe you know how

Thanks,

Not applicable
Author

The best way of doing this is to have a field which contains only month (number). Then you can calculate month based on oDate.

count({<MonthNumber={">$(=Num(Month(Max(oDate)))-3))"},[qID_3_Task completion]={'Yes'}>}[qID_3_Task completion])/

Count({<MonthNumber={">$(=Num(Month(Max(oDate)))-3))"}>}TOTAL <MYear> [qID_3_Task completion])

So create a field MonthNumber which resides in your table and then add the above expression to your graph.

Greetings,

Marc

Anonymous
Not applicable
Author

Hello Marc,

When I create variable Num(Month(submitDateTime)) as MonthNumber,

Jan 2013 and Jan 2012 will be 1.

It doesn't work max(1)-3 it shows -2.

Please see my attached file.

Thanks,

Not applicable
Author

Vladimir,

that is true. So for Jan, Feb and Mar you need to fix this by adding an if statement telling that if MonthNumber is <= 3 then it will be 12, 11, or 10.

And then you also need to do something with year. Create a variable with vYear = Year(Today()) in you load script or as variable and set vYear to Year(Today())-1 if MonthNumber <= 3.

Hope you understand what I mean.

Greetings,
Marc

Anonymous
Not applicable
Author

Maybe is better to use dual functions

Could you show example?

Regards,

Not applicable
Author

You Sir, are my hero. Thank you.