Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Billy_u
Creator
Creator

SET ANALYSIS COMPLEX

I have to do this calculation, it tells me that the formula is syntactically ok, but really the analysis set does not work? what am I wrong?

 

=if(GetSelectedCount (MONTH)=12 or GetSelectedCount (MONTH)=0,

sum({<YEAR = {$(=max(YEAR))},CODE={"1*"}>}SALES),
if(sum({<YEAR = {$(=max(YEAR)-1)},CODE={"1*"}>}SALES)>0,

[sum({<YEAR = {$(=max(YEAR)-1)},CODE={"1*"}>}SALES)

*sum({<YEAR = {$(=max(YEAR))},CODE={"1*"}>}SALES)

/sum({<YEAR = {$(=max(YEAR)-1)},CODE={"1*"}>}SALES)],

sum({<YEAR = {$(=max(YEAR))},CODE={"1*"}>}SALES)]/Count(DISTINCT {<YEAR = {$(=max(YEAR))} >} MONTH)*12))

Labels (2)
1 Solution

Accepted Solutions
Nicole-Smith

It's not going to work with the square brackets you have in the expression (and I'm not sure why they are there to begin with):

=if(GetSelectedCount (MONTH)=12 or GetSelectedCount (MONTH)=0,
sum({<YEAR = {$(=max(YEAR))},CODE={"1*"}>}SALES),
if(sum({<YEAR = {$(=max(YEAR)-1)},CODE={"1*"}>}SALES)>0,
[sum({<YEAR = {$(=max(YEAR)-1)},CODE={"1*"}>}SALES)
*sum({<YEAR = {$(=max(YEAR))},CODE={"1*"}>}SALES)
/sum({<YEAR = {$(=max(YEAR)-1)},CODE={"1*"}>}SALES)],
sum({<YEAR = {$(=max(YEAR))},CODE={"1*"}>}SALES)]/Count(DISTINCT {<YEAR = {$(=max(YEAR))} >} MONTH)*12))

View solution in original post

2 Replies
Nicole-Smith

It's not going to work with the square brackets you have in the expression (and I'm not sure why they are there to begin with):

=if(GetSelectedCount (MONTH)=12 or GetSelectedCount (MONTH)=0,
sum({<YEAR = {$(=max(YEAR))},CODE={"1*"}>}SALES),
if(sum({<YEAR = {$(=max(YEAR)-1)},CODE={"1*"}>}SALES)>0,
[sum({<YEAR = {$(=max(YEAR)-1)},CODE={"1*"}>}SALES)
*sum({<YEAR = {$(=max(YEAR))},CODE={"1*"}>}SALES)
/sum({<YEAR = {$(=max(YEAR)-1)},CODE={"1*"}>}SALES)],
sum({<YEAR = {$(=max(YEAR))},CODE={"1*"}>}SALES)]/Count(DISTINCT {<YEAR = {$(=max(YEAR))} >} MONTH)*12))

Billy_u
Creator
Creator
Author

oops, I must have really crossed my eyes, thank you very much...