Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
upaliwije
Creator II
Creator II

variable

I have created the following expression using ENetProfit as a variable. But It is not working. Pls help me to trace where I have gone wrong

SUM( {$<YEAR = {"$(=Only([YEAR]))"}>} [ENetProfit])
1 Solution

Accepted Solutions
brijesh1991
Partner - Specialist
Partner - Specialist

if your year is fiscal year i.e 2013-14, then

SUM( {$<YEAR = {'$(=Only(YEAR))'}>} [ENetProfit])

if your year is normal year i.e 2014, then

SUM( {$<YEAR = {'$(=Max(YEAR))'}>} [ENetProfit])

View solution in original post

5 Replies
rustyfishbones
Master II
Master II

what is the variable?

can you share the expression within the Variable

upaliwije
Creator II
Creator II
Author

(sum( {<NOTE = {'100'}>}[ACTUAL] )*-1)

this is my expression for variable

rustyfishbones
Master II
Master II

it wont work, why not create a variable for the whole thing

EOnlyYearNetProfit

sum( {<NOTE = {'100'},YEAR = {"$(=Only([YEAR]))"} >}[ACTUAL] )*-1)

Anonymous
Not applicable

You should save only the set expression that is enclosed in the angle brackets "<>" into a variable.  So vNetProfit should be

vNetProfit =            NOTE = {'100'}


So your base equation would be eNetProfit = SUM({$<$(vNetProfit)>}[ACTUAL]*-1).


When you expand upon it then it would look like this.


eNetProfittByYearOnly = SUM({$<$(vNetProfit),YEAR = {"$(=Only([YEAR]))"}>}[ACTUAL]*-1).







brijesh1991
Partner - Specialist
Partner - Specialist

if your year is fiscal year i.e 2013-14, then

SUM( {$<YEAR = {'$(=Only(YEAR))'}>} [ENetProfit])

if your year is normal year i.e 2014, then

SUM( {$<YEAR = {'$(=Max(YEAR))'}>} [ENetProfit])