Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
QSense
Creator II
Creator II

dimension previous values

My dimension is =date(WeekStart(ISTEK_ACISTARIHI2),'DD.MM.YYYY')

As you understand it gets startofweek

in my data last startweek 19.11.2012 week

how can I get previous week start date 12.11.2012 and previous start week dates

=date(Max( date(WeekStart(ISTEK_ACISTARIHI2),'DD.MM.YYYY'))) it gets last week start date

6 Replies
Anonymous
Not applicable

Previous week start date is a start date of the week 7 days before the date:
date(WeekStart(ISTEK_ACISTARIHI2-7),'DD.MM.YYYY')

Or, 7 days before the start date, if you prefer so:

date(WeekStart(ISTEK_ACISTARIHI2)-7,'DD.MM.YYYY')

Regards,
Michael

QSense
Creator II
Creator II
Author

Hello Michael ,

Thanks for reply the actual problem is that

=count((if(date(today(),'DD.MM.YYYY')-date(ISTEK_ACISTARIHI2,'DD.MM.YYYY')>=30 and ISTEK_DURUM='Açık',1))) in this expression when I calculated 30 days before today data

it is ok

but if I try to calculate for dimension you sent It gives 0

I want to  calculated 30 days before date just you sent

date(WeekStart(ISTEK_ACISTARIHI2-7),'DD.MM.YYYY')

Anonymous
Not applicable

In this case, if I got your requirements correctly tjhis time, don't change your dimension, but use this expression (you don't need to format the dates here):

count((if(date(today()-7)-date(ISTEK_ACISTARIHI2)>=30 and ISTEK_DURUM='Açık',1)))

QSense
Creator II
Creator II
Author

I want to  calculated 30 days before date just you sent

date(WeekStart(ISTEK_ACISTARIHI2-7),'DD.MM.YYYY')

QSense
Creator II
Creator II
Author

In qw file attached , İn turuncu hat istekler tab you can see my example

Anonymous
Not applicable

I doubt that you have it the way you actually need.
From your description, I understand that you want to see, for each week, a count of items between the start of this week, and 30 days back from that point.  For example, if weekstart is Dec 26, 2012, you want to count items between Nov 27 and Dec 26.  Instead, your expression returns the count for each week if the item is within this week and older than 30 days.  As a result, you get simply weekly counts for older weeks and 0 for the most recent weeks.
If my assumption is correct, you need a logical data island for weeks, and use it as dimension in the chart.  If you call this field WeekStart, your expression will be
count(if(ISTEK_ACISTARIHI2<=WeekStart and ISTEK_ACISTARIHI2>WeekStart-30 and ISTEK_DURUM='Açık', 1)))
And, the "previous" will be
count(if(ISTEK_ACISTARIHI2<=WeekStart-7 and ISTEK_ACISTARIHI2<Weekstart-37 and ISTEK_DURUM='Açık', 1)))

Regards,
Michael
PS: If I find time later, I'll create a sample app.