Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Set analysis in load script

Hey guys,

I'm trying to look at the increase in Annual Fees between two years by calculating it in the load script. I want to do it in the load script because I need to do set analysis on it as well.

I have a field named 'Annual_Fee' and a field 'Fee_Fiscal_Year' and basically I'm trying to seperate the 2014/2015 and 2013/2014 years and calculate the difference.

I'm trying to do this in the load script:

Sum({$<Fee_Fiscal_Year = {'2014/2015'}>}Annual_Fee) - Sum({<Fee_Fiscal_Year = {'2013/2014'}>}Annual_Fee) as "Increase $"

But it's not working because of the curly brackets. Do you guys know how I can get around this?

5 Replies
MVP
MVP

Re: Set analysis in load script

Hi,

It is not permitted to use Set Analysis in the script, set analysis can be used in front end only.  To achieve this you can try it in a different way.

Can you attach some sample data?

Regards,

jagan.


Employee
Employee

Re: Set analysis in load script

Some loose thoughts are that you might be able to resolve this by using Group By in load statements in combination with joins. The correct answer depends on your data structure, so a simple sample QVW would be required to answer your question.

rgvavihs
Valued Contributor

Re: Set analysis in load script

Hi ,

you can't use set analysis in script,u can do it in only in front end

bhagirath
Contributor III

Re: Set analysis in load script


Hi James,


Try this

(if(Fee_Fiscal_Year = '2014/2015', Sum(Annual_Fee)) -if(Fee_Fiscal_Year = '2013/2014', Sum(Annual_Fee)) as "Increase $"

Fee_Fiscal_Year  but Fiscal year is single field

it can not have 2014/2015 and 2013/2014 for the same row

This will not work for sure but this is the if else analysis conversion of your set analysis


it would be better if you can share sample application to understand data model

Not applicable

Re: Set analysis in load script

Hey guys, thanks for the response!

Unfortunately I can't share the app, but I've decided to just leave the expression in the app anyway. It's only a matter of copy&pasting anyway so no big deal.

Community Browser