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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Adding $ current selection to the statement?

Does anyone know how to add current selection to the following expression?

(sum(if (InWeek (DaysFilled.Date, (Today()), -52), DaysFilled.Days))) / (count(distinct(if (InWeek (DaysFilled.Date, (Today()), -52, DaysFilled.Date))))

The expression works but not with current selection>

Thank you in advance!

1 Reply
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

you'll have to explain a bit more how this expression doesn't work with current selection. What selection do you make and what's happening wrongly?

I have a feeling that there is a syntax error in your expression - looks like one of the closing quotes might be misplaced.

Also, I'd recommend to simplify your expression by moving the IF question back to the load script and defining a "flag" that can determine whether the date DaysFilled.Date is within the last 52 weeks from today:

load

...

if (InWeek (DaysFilled.Date, (Today()), -52), 1, 0) as Flag_52Weeks,

...

Then, your expression should look like this:

sum({<Flag_52Weeks={1}>}   DaysFilled.Days)/ count({<Flag_52Weeks={1}>}  distinct DaysFilled.Date)

much simpler, cleaner and faster...

cheers,

Ask me about Qlik Sense Expert Class!