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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Shurik
Contributor
Contributor

filters and set analysis

Hi. there is a task to draw a table with a built-in minidagram, such as: "METRIC" - "VALUE FOR NOW" - "DYNAMICS"

There are no problems with dynamics.

But?,when I try to calculate the "value for now" like this:

=sum(${<WEEK_START={'=Max(WEEK_START)'}>} VALUE) does not work.

At the output - all the same SUM (VALUE).

canceling other filters like <Year => also useless.

tell me what I'm doing wrong?

5 Replies
JuanGerardo
Partner - Specialist
Partner - Specialist

Hi @Shurik , if you want to include an expression into another one, you need to use the dollar sign expansion, it should be something like this:

=sum(${<WEEK_START={'$(=Max(WEEK_START))'}>} VALUE)

JG

Vegar
MVP
MVP

As @JuanGerardo  states , you can use dollar expansions to solve this.

If your WEEK_START is a date, formated with a certain pattern, then you will need to format your dollar expansion in the same pattern. 

Let's assume your WEEK_START a date formated in this pattern: YYYY-MM-DD (Eg. 2021-05-10) then you need to adjust JG's expression like this:

=sum(${<WEEK_START={"$(=date(Max(WEEK_START) ,'YYYY-MM-DD')"}>} VALUE)

OmarBenSalem
Partner - Champion II
Partner - Champion II

in a set expression :

1) if we wanna work with the year 2016 for example which is numeric: we call it without quotes:

Year={2016}

2) If we wanna focus on a country, Tunisia for example which is a string: we call it with quotes

Country={'Tunisia'}

3) If it's an expression, let's say Max(Date), you do as follow :

Step 1 : Max(Date) is calculation so it need a =.

=max(Date)

Step 2 :to force qlik to calculate this, you surround it by a $() sign (see it as the let and set in the script .. let = calculation, set leave it as it is..)

$=(max(Date))

FYI : as I said, $() is to force the calculation; in some cases, u do need to force it because it's already is implicitely.

Here's a case : show Users that have sum(Sales)>100.

the expression would be like this :

1) count(distinct Users)

2) the conditon is on users with sum(sales) > 100

Users={"=sum(Sales)>100"}

In this case you don't need the $(); why? because the expression (sum(sales)) is already FORCED to "calculate" by comparing it to 100.

hope this was clear?

Step 3 :Last step? surround by double quotes :

Date={"$=(max(Date))"}

in your case : sum(${<WEEK_START={"$(=Max(WEEK_START))"}>} VALUE)

Shurik
Contributor
Contributor
Author

Thanks! Ithought that the first "$" inn expression works on the whole expression..

But.. solution doesn't work to. I've attached a screenfhot with the results

Shurik
Contributor
Contributor
Author

Hi! thank you for your answer. but, the result is the same..