Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Delphines
Contributor III
Contributor III

Sum with variable not showing the expected result

Hi All, 

I have this weird behavior in my pivot chart I don't succeed to explain and hope you will find an explanation !

I have: 

  • a variable called vSalesInno_Month defined as
    Sum({$<MonthDiff={0}>} if(LaunchDate>=$(vInnoStartMonth),1,0)*[€ PUB]) 
  • Sales as Expression in my chart
    = Sum({$<MonthDiff={0}>} [€ PUB])
  • Sales_wo_Inno as Expression in may chart
    = Sum({$<MonthDiff={0}>} [€ PUB])-$(vSalesInno_Month)

in the chart, I have the right figures for
- vSalesInno
- Sales
but not Sales_wo_Inno i.e. Sales_wo_Inno <> Sales - vSalesInno_Month as written in the expression

I know vSalesInno_Month is the right figure as I also put the full formula in another expression to check whether this was the issue, and the result shown is the exact same one as just writing =$(vSalesInno_Month) in the Expression box.

anyone any clue?

thanks a lot for your help!

Labels (1)
1 Solution

Accepted Solutions
Delphines
Contributor III
Contributor III
Author

I found : I have to add parenthesis for the variable and write 

Sum({$<MonthDiff={0}>} [€ PUB])-($(vSalesInno_Month)) instead.

View solution in original post

1 Reply
Delphines
Contributor III
Contributor III
Author

I found : I have to add parenthesis for the variable and write 

Sum({$<MonthDiff={0}>} [€ PUB])-($(vSalesInno_Month)) instead.