Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Read about Qlik’s Response to COVID-19 Read the Letter, Join the Group.
Highlighted
New Contributor II

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
Highlighted

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

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

Highlighted
New Contributor II

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

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.

Highlighted

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

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

)

Highlighted
New Contributor II

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

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

Highlighted

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

Difficult to know what might be wrong without taking a look