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: 
Not applicable

YTD with variable?

Hi all.
I have a problem wit Set Analysis. I'm making a YTD calculation that Works fine as long as I don't use a variable to calculate. The function I'm trying to use look like this:
= sum({$<Month = {'<= $(v_MaxMonth)'}>} $(v_EB_Actual_KKR) )
If I use a fact instead of an variable it works fine.
Any ideas how to solve this?

Best Regards
/Kari
1 Solution

Accepted Solutions
gandalfgray
Specialist II
Specialist II

Hi Varis

Is it correct syntactically to have Sum inside Sum? - I have never used that as I can recall.

When I try it in a simple table chart it does not work anyway.

/g

View solution in original post

5 Replies
Not applicable
Author

How the variable is defined?

Not applicable
Author

The variable is complicated, it starts like this:

if(ReportRow_EB = 'Heating sales end customer, fixed fee'
,
Sum({< EB_PURPOSE_CODE *= {'FAST','EFFEKT'} >} [EB_ACTUAL_KKR] *$(v_RapportStandard) ),

if(ReportRow_EB  = 'Heating sales end customer, variable fee'
,Sum({< EB_PURPOSE_CODE *= {'FLÖDE', 'ENERGI', 'INGET'} >}
[EB_ACTUAL_KKR] *$(v_RapportStandard) ),

if(ReportRow_EB  = 'Heating sales distributors, fixed fee'
,Sum({< EB_PURPOSE_CODE *= {'FAST','EFFEKT'} >}
[EB_ACTUAL_KKR] *$(v_RapportStandard) ),
.
.
.

gandalfgray
Specialist II
Specialist II

Hi Varis

Is it correct syntactically to have Sum inside Sum? - I have never used that as I can recall.

When I try it in a simple table chart it does not work anyway.

/g

gandalfgray
Specialist II
Specialist II

Hi Varis

try to move

Month = {'<= $(v_MaxMonth)'}

inside the set expressions in the v_EB_Actual_KKR variable

and remove the outer sum so the expression would just be:

= $(v_EB_Actual_KKR)

hth/gg


Not applicable
Author

I tried to have Sum inside Sum and it didn't work, propably theere my error is.

Thank you for the help.