Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to use a date to show weekly trends in chart dimension

Hello,

I'm trying to figure out how to use log in date as a dimension to show weekly trends. I'm currently displaying it by week #, but i'm trying to figure out way to display a week range of the last 7 days.

This is what i'm currently using, but I would prefer the actual date range to show.

=if(week( LOGIN_DATE)<=8, week( LOGIN_DATE))

Thanks

1 Solution

Accepted Solutions
MarcoWedel

I guess you used your actual field names, i.e. something like:

Dual(WeekStart(LOGIN_DATE)&' - '&WeekEnd(LOGIN_DATE),WeekStart(LOGIN_DATE))

if this doesn't work, can you please post some sample of your application that shows this behaviour?

Preparing examples for Upload - Reduction and Data Scrambling

thanks

regards

Marco

View solution in original post

6 Replies
Vegar
MVP
MVP

Is this what you are looking for?

=if((today() - LOGIN_DATE)<7, LOGIN_DATE)

MarcoWedel

Hi,

I guess you are looking for a calculated dimenstion like:

Dual(WeekStart(Date)&' - '&WeekEnd(Date),WeekStart(Date))

QlikCommunity_Thread_248523_Pic1.JPG

Due to performance reasons it might be better to calculate the week as a new field in the script:

LOAD *,

    Week(Date) as Week,

    Dual(WeekStart(Date)&' - '&WeekEnd(Date),WeekStart(Date)) as WeekName;

LOAD Date(MakeDate(2017)+RecNo()-1) as Date,

    Ceil(Rand()*100) as SomeFact

AutoGenerate 365;

hope this helps

regards

Marco

Not applicable
Author

Hi Marco, your graph is showing exactly how I need it to, but the dimension didn't work for me. I tried loading using the script you provided, but would I then just use week as a dimension? if so, that didn't work either

MarcoWedel

I guess you used your actual field names, i.e. something like:

Dual(WeekStart(LOGIN_DATE)&' - '&WeekEnd(LOGIN_DATE),WeekStart(LOGIN_DATE))

if this doesn't work, can you please post some sample of your application that shows this behaviour?

Preparing examples for Upload - Reduction and Data Scrambling

thanks

regards

Marco

Not applicable
Author

that worked, thank you!

MarcoWedel

you're welcome

regards

Marco