Qlik Community

App Development

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

Announcements
IMPORTANT security patches for GeoAnalytics Server available to download: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
birkirbjorns
Contributor III
Contributor III

Set expression with variable syntax question or a small issue

Hi,

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
sunny_talwar

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
sushil353
Master II
Master II

Try this:

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


HTH

Sushil

birkirbjorns
Contributor III
Contributor III
Author

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?

vinieme12
Champion III
Champion III

please post a sample app

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

May be this:

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


Aggr(


Sum( $(v_Filter_WTD) Sales )/1000000

, YourChartDimensionsHere)

birkirbjorns
Contributor III
Contributor III
Author

Hi all,

Just added an sample app.

sunny_talwar

What is the expected output here?

birkirbjorns
Contributor III
Contributor III
Author

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?

sunny_talwar

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

sunny_talwar

Tested the second one with a new variable called vTest