Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

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

Re: Set analysis question

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

Regards,

Kiran Rokkam.

7 Replies
Not applicable

Re: Set analysis question

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

Regards,

Kiran Rokkam.

Not applicable

Re: Set analysis question

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

Re: Set analysis question

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

MVP
MVP

Re: Set analysis question

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

Not applicable

Re: Set analysis question

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?

Re: Set analysis question

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

Re: Set analysis question

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.

.

Community Browser