Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Is it possible and how to use arithmetic operations over selected values and set result of these operations as a value in Set Expression?

Have same weekly data and task to make a report for previous week relative to selected one.

Get data for selected week is easy task:

Sum({$<[WeekStartDate] = $([WeekStartDate])>}

// some complicated calculation here

)

For previous week hoped following code will do but failed:

Sum({$<[WeekStartDate]={"$(=(Num([WeekStartDate])))-7"}>}

  

// some complicated calculation here

)

I'm relatively new to Qlik Sense, so will be grateful for any help.

5 Replies
sunny_talwar

May be try this

Sum({$<[WeekStartDate] = {"$(=Date([WeekStartDate]-7, 'DateFieldFormatHere'))"}>}

// some complicated calculation here

)

Replace the DateFieldFormatHere with the format for WeekStartDate Field. Also, read here

Dates in Set Analysis

Anonymous
Not applicable
Author

Checked that:
As a WeekStartDate I have for example value 42912.

And it works great with other data fields calculations, but not with user selection.

sunny_talwar

What selections are making? Do you need a max function if there are more than one date?

Sum({$<[WeekStartDate] = {"$(=Date(Max([WeekStartDate])-7, 'DateFieldFormatHere'))"}>}

// some complicated calculation here

)

Anonymous
Not applicable
Author

It is/will be selection of one week, therefore one date. Not an issue.

sunny_talwar

Difficult to know what might be wrong without taking a look