Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
JohnSamuel123
Creator
Creator

count of values >= Current week

hi, 

i have a measure that gives a count of future values. however i also want it to include the current week values as well, currently it is just showing me future values, even though i have >= sign. 

Count({$<WeekStartDate={">=$(=Date(today(), 'YYYY-MM-DD'))"}>} [%ID])

my WeekStartDate are date formats that record every monday of each week both past and future:

JohnSamuel123_0-1651749020235.png

 

 

when i select the current week number, my bar chart displaying nothing, even though it should display the current week records.

 

how do i format my above expression so that it also takes in the current week into the values and not just future records?

 

thanks,

 

Labels (5)
1 Solution

Accepted Solutions
JohnSamuel123
Creator
Creator
Author

it appears qlik thinks it is week 20 while for us here in ireland it is week 19. this worked:

Count({$<WeekStartDate={">=$(=Date(today()-7, 'YYYY-MM-DD'))"}>} [%ID])

 

 

View solution in original post

6 Replies
NitinK7
Specialist
Specialist

can you send weekstartdate and id column data ?

JohnSamuel123
Creator
Creator
Author

hi @NitinK7 see attached

vinieme12
Champion III
Champion III

Count({$<WeekStartDate={">=$(=Date(Max(WeekStartDate), 'YYYY-MM-DD'))"}>} [%ID])

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
JohnSamuel123
Creator
Creator
Author

hi @vinieme12 , your suggestion uses Max WeekStart Date. as i have future weeks going into 2023 in my dataset already this does not work.  i need it to get the current week and future, currently i can only get future weeks using 

 

Count({$<WeekStartDate={">=$(=Date(today(), 'YYYY-MM-DD'))"}>} [%ID])

JohnSamuel123
Creator
Creator
Author

it appears qlik thinks it is week 20 while for us here in ireland it is week 19. this worked:

Count({$<WeekStartDate={">=$(=Date(today()-7, 'YYYY-MM-DD'))"}>} [%ID])

 

 

vinieme12
Champion III
Champion III

You need to create variable to support user behavior

 

for example if user hasn't selected any Date, then show data from today to future date

if user has selected a particular weekstartdate then show data from selected weekstartdate to future date

 

so variable

vDate = Date(if(getselectedcount(WeekStartDate),   max(WeekStartDate) ,  Today()   ),'YYYY-MM-DD')

 

Then use the variable

Count({$<WeekStartDate={">=$(vDate)"}>} [%ID])

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.