Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
carolin01
Luminary Alumni
Luminary Alumni

Set Analysis

Hi,

Could anybody help me to correct my variable:

vRevenueTotalMax = sum({$<FYear = {$(=Max(FYear))}, OrderPhase_Desc = {Revenue}>} NettAmount$(vCurrency));

I would like to see the Revenue for the Maximum Year that I choose from a List box. But it´s not calculating anything.

It´s for sure something about brackets etc or similar...

Many thanks for your comments.

Best regards

Carolin

20 Replies
stigchel
Partner - Master
Partner - Master

Depending on format of your year (date?) consider the following:

use the date function to give the set expression the string it is expecting using the dual date function

{<Month='$(=Date(AddMonths(Date#(Max([$(=Dimension)]),'YYYYM'),-1),'MMM-YY'))'>}

carolin01
Luminary Alumni
Luminary Alumni
Author

Unfortunately not - I maybe this information helps:

This is working:

= sum({$<OrderPhase_Desc = {Revenue}>}    NettAmount$(vCurrency))

This is not working:

= sum({$<FYear = {"$(=Max(FYear))"}>}  NettAmount$(vCurrency))

Not applicable

Is your FYear a number? try MaxString(FYear)

carolin01
Luminary Alumni
Luminary Alumni
Author


Good question - I didn´t know it and tried but unfortunately it still didn´t work...

maxgro
MVP
MVP


does it works?

= sum({$<FYear = {2014}>}  NettAmount$(vCurrency))

and what's the result of a textbox with?

=Max(FYear)

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Remove the label from your expression. Then hover over the column heading and you'll be able to see exactly how the expression is being expanded. That may provide a clue.

-Rob

carolin01
Luminary Alumni
Luminary Alumni
Author


=Max ( FYear) gives me the maximum year from the selection that I do in a Listbox, which is correct.

This is working, too:

=sum({$<FYear = {2014}, OrderPhase_Desc = {$(vOrderPhaseDesc)}>}NettAmount$(vCurrency))

carolin01
Luminary Alumni
Luminary Alumni
Author


I think we are getting close now. In a textbox this is working and gives a correct result:

=sum({$<FYear = {$(=Max(FYear))}, OrderPhase_Desc = {'Revenue'}>} NettAmount$(vCurrency))

Now I used this to set a variable:

set vRevenueTotalMax = sum({$<FYear = {$(=Max(FYear))}, OrderPhase_Desc = {'Revenue'}>} NettAmount$(vCurrency));

Then I used the variable in a text box but the result is Null:

=$(=vRevenueTotalMax)

maxgro
MVP
MVP

- replace in working expression 2014 with "$(=Max(FYear))"

- read Rob suggestion

- what's the expression expanded if you select year 2014, 2013, .....?

do you get 2014 for "$(=Max(FYear))" or what?

or post your doc

preminqlik
Specialist II
Specialist II

TRY THIS

=vRevenueTotalMax

OR

=$(vRevenueTotalMax)