Qlik Community

Ask a Question

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Talk to Experts Tuesday, January 26th at 10AM EST: Qlik Sense. REGISTER NOW
Showing results for 
Search instead for 
Did you mean: 
Contributor III
Contributor III

Set expression with variable syntax question or a small issue


I have inherited one app with a expression syntax that I do not know how to handle.

It is a WTD calculation and works fine this is the expression :

Sum( $(v_Filter_WTD) Sales )/1000000

This is the expression in the variable

{$<DateKey={"$(='>=' & '$(v_StartOfWeek)' & '<=' & '$(v_EndOfWeek)')"},Year=,Month=,Week=,Day=,fYear=>}

So in the calculation I need to add an filter, so I want to add for example StoreNo = 55 into the expression.

I have not managed todo so.

Any hints?

Message was edited by: Birkir Bjornsson

1 Solution

Accepted Solutions

That is my bad....

vTest needs to be without storeNo field in it

$<DateKey = {"$(='>=' & '$(v_StartOfWeek)' & '<=' & '$(v_EndOfWeek)')"}, Year=, Month=, Week=, Day=, fYear=>

View solution in original post

15 Replies
Master II
Master II

Try this:

{$<DateKey={"$(='>=' & '$(v_StartOfWeek)' & '<=' & '$(v_EndOfWeek)')"},StoreNo={'55'},Year=,Month=,Week=,Day=,fYear=>}



Contributor III
Contributor III

Hi Sushil,

Thanks for your valid input, yes this solves this. But I was hoping to be able to have the WTD filter universal and add the StoreNo = 55

into this expression

Sum( $(v_Filter_WTD) Sales )/1000000, that I have not been able to solve.

Any ideas?

Champion II
Champion II

please post a sample app

May be this:

Sum({$<DateKey={"$(='>=' & '$(v_StartOfWeek)' & '<=' & '$(v_EndOfWeek)')"},StoreNo={'55'},Year=,Month=,Week=,Day=,fYear=>}


Sum( $(v_Filter_WTD) Sales )/1000000

, YourChartDimensionsHere)

Contributor III
Contributor III

Hi all,

Just added an sample app.

What is the expected output here?

Contributor III
Contributor III

Well the idea here would bet do add an storeno filter into the expression in the top KPI,

So for example set StoreNo = 24 should show 15.08K in the Kpi as WTD sales.

So is it somehow possible to add storeno into the set analysis using the wtd variable as is, So that could be an universal variable and then add whatever extra filters you need into the set analysis.

does that makes sense?

May be like this?

Sum({$<DateKey = {"$(='>=' & '$(v_StartOfWeek)' & '<=' & '$(v_EndOfWeek)')"}, StoreNo ={'24'}, Year=, Month=, Week=, Day=, fYear=>} Aggr(Sum( $(v_Filter_WTD) Sales )/1000000, DateKey))

or if you can define your variables like this (without the curly brackets at the start and end)

$<DateKey = {"$(='>=' & '$(v_StartOfWeek)' & '<=' & '$(v_EndOfWeek)')"}, StoreNo ={'24'}, Year=, Month=, Week=, Day=, fYear=>

then this might work

Sum({$(v_Filter_WTD)*<StoreNo ={'24'}>} Sales)/1000000

Tested the second one with a new variable called vTest