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: 
master_student
Creator III
Creator III

value of week -1

Hello Guys,

I need to get the value of week -1 compared with week of today()-1 / any idea ?

Here are the fileds of week of my calendar dimension:

Capture.PNG

if u like, i will give you my calendar dimension script

Thanks a lot

11 Replies
sunny_talwar

In which object?

tresesco
MVP
MVP

For last week against a date field, try like:

Week(Date-7) as LastWeek

For static week value compared to today, try like = Week(today()-7)

master_student
Creator III
Creator III
Author

here is my expression :

=num(sum(RVN_AIRTIME ) ,'# ##0')

sunny_talwar

I asked about which object are you trying to do this? Text box? Straight table? Bar chart?....

master_student
Creator III
Creator III
Author

sorry, it s a text box

sunny_talwar

May be this

=Num(Sum({<[calendar date] = {"$(='>=' & Date(Today() - 8, 'D/M/YYYY') & '<=' & Date(Today() - 1, 'D/M/YYYY'))"}>}RVN_AIRTIME ) ,'# ##0')

So, if today is 10/23/2017, the above expression will show 10/15/2017 to 10/22/2017. Tomorrow when it will be 10/24/2017, the above expression will show 10/16/2017 to 10/23/2017. Is this what you want?

master_student
Creator III
Creator III
Author

Thanks Sunny, That's it, but i want to use a week of date filed in my calendar dimension, but it didn't work :

=num(sum({<[Week of date]  = {"$(=[Week of date]-1)"} >} RVN_AIRTIME),'# ##0')

is there any error in my expression ?

Thanks

Or
MVP
MVP

This is a little tricky, because it depends on your week numbering system.

Getting the week value for all but the first/last weeks is easy - just subtract one.

If it's important to get this correct for the first/last week (which can be 52, 53, or 54 depending on system and may be a partial week depending on system), you'll have to use the same function for this as you did to get the week numbers in the first place. As long as you aren't using partial weeks, the approach suggested by Tresesco above - Date-7 - should work.

sunny_talwar

Why week of date? what is the issue with calendar date?