Qlik Community

App Development

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

Announcements
Join “Do More With Qlik” with Mike Tarallo to get a first-hand look at the New Authoring Experience, June 29th: REGISTER HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
rcandeo
Creator III
Creator 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?

11 Replies
jonathandienst
Partner
Partner

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
Creator III
Creator III
Author

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

tresesco
MVP
MVP

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
Creator III
Creator III
Author

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
Creator III
Creator III
Author

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))"}

Gabriel
Partner
Partner

Hi,

Are you able to provide sample data or qvf file?

This might help to resolve

rcandeo
Creator III
Creator III
Author

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
Contributor III
Contributor III

Hi Rcandeo,

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

HTH
Ravi
pepecc
Contributor III
Contributor III

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.