Qlik Community

Qlik Sense Advanced Authoring

Discussion board where members can learn more about Qlik Sense Advanced Authoring.

rcandeo
Contributor III

why is this set analysis not working?

I have this expression that works bringing amount

sum({$<YearMonth_LayOut={"$(=$(vYearMonth))"}>} amount)

But it brings only actual year/month and I need to see the months till actual month not including it. So I change the expression to

sum({$<YearMonth_LayOut={"<$(=$(vYearMonth))"}>} amount) and it brings me nothing

vYearMonth has the result = 2019/07 and I have data for YearMonth_LayOut since last year

Any idea what is wrong in  my expression please?

Tags (1)
11 Replies
Highlighted
MVP
MVP

Re: why is this set analysis not working?

Is the [YearMonth_LayOut] field a numeric (like a date or dual value)?

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
rcandeo
Contributor III

Re: why is this set analysis not working?

No, it is a text field like ˜2019/07˜

MVP
MVP

Re: why is this set analysis not working?

And are you also expecting a textual/string comparison when comparing with </> sign? I guess not, right?  Try to create a numeric/dual field in the script and use the same in set analysis here.

rcandeo
Contributor III

Re: why is this set analysis not working?

Are you telling me the problem is the ˜/˜ or comparing a text field?

Just to understand what I have to do

I could bet that this comparison should work, but this can explain my day lost trying to make it happen

rcandeo
Contributor III

Re: why is this set analysis not working?

I changed the field to numeric without the "/" and did not get how to work

this way works selecting only actual year/month

YearMonth_Num_LayOut={"$(=$(vYearMonthNum))"}

but if I try to see only previous ones, nothing comes:

YearMonth_Num_LayOut={"$(<=$(vYearMonthNum))"}

Partner
Partner

Re: why is this set analysis not working?

Hi,

Are you able to provide sample data or qvf file?

This might help to resolve

rcandeo
Contributor III

Re: why is this set analysis not working?

I am in a client and unfortunatelly I cannot share their data, but see the image with the table view and variable view if can help you and thank you in advance

 

Captura de Tela 2019-07-18 às 11.11.51.png

ravishankarqv
New Contributor III

Re: why is this set analysis not working?

Hi Rcandeo,

Try this.
YearMonth_Num_LayOut={$(#vYearMonthNum)}

HTH
Ravi
pepecc
New Contributor III

Re: why is this set analysis not working?

I would have written the expression like this:

 

sum({$<YearMonth_LayOut={"<'$(vYearMonth)'"}>} amount) 

or  maybe

sum({$<YearMonth_LayOut={"<$(vYearMonth)"}>} amount) 

Think that you do not have to opperate with the value loaded into the variable, then you just need to substitute its contain in set analysis.

 

Hope it helps.