Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set analysis question

I have a data model that has data for multiple years.  The year is stored in a field called custOutcomeYear.  I would like to create a chart that only  sum current revenue data for the current year.  The current year is in a varialbe called vCurrentYear.  Can this be dine using set analysys?  If so how??

Thanks in advance.

1 Solution

Accepted Solutions
Not applicable
Author

sum({<custOutcomeYear={"$(=vCurrentYear)"}>} current_revenue)

Regards,

Kiran Rokkam.

View solution in original post

7 Replies
Not applicable
Author

sum({<custOutcomeYear={"$(=vCurrentYear)"}>} current_revenue)

Regards,

Kiran Rokkam.

Not applicable
Author

same purpose, (slightly) less code, less prone for failures (no (,{ and <>)

sum(if(custOutcomeYear=$CurrentYear,current_revenue))

or

sum(if(custOutcomeYear=$CurrentYear AND day=$today ,current_revenue))

Not applicable
Author

Hi Alexander / all,

wouldn't the set analysis be a more efficient way of doing this (ie system performance), as it removes the line by line evaluation of the "if" statement?

Please advise,

Kind regards,

Rich

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Sum(If()) expressions should be used with caution - they perform very poorly (or not at all) on large data sets. Set analysis expressions perform far better.

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

So if I wanted to display only data for the current year, thein I would have to use something like that for each field I wat to display?

CELAMBARASAN
Partner - Champion
Partner - Champion

Use only for year field, if u need to display disregarding the selection of month, day, quarter, week then exclude that fields

sum({<custOutcomeYear={$(=vCurrentYear)}, Month=, Week=, Quarter=, Day=>} current_revenue)

Not applicable
Author

set analysis is indeed far more performance efficient.

i wanted to provide an example, as joestang was new to set analysis.

so, if your set analysis seems not to be working, try the more simple example to test your parameters.
if they dont work with the "sum(IF)" example, the problem is not in set analysis, but in the parameter.

.