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

using if statement in a line chart not working

Anybody know off hand why this works in a text box expression , but not as an expression in a line chart:

=if(Count(Month_Year)=1,

sum({<

Year = , Quarter = , Month = ,

CAL_ACCTG_PERIOD = {">$(=MonthStart(Date(Month_Year), -11))<=$(=MonthEnd(Date(Month_Year)))"},

[Accounting Basis Code]={'STAT'},

[Company Code] = {"*"} - {'06'},

[Report Format] ={'IS'},

[Report Section]={">=100<=700"}

>}Amount)*-1

,sum({<

Year = , Quarter = , Month = ,

CAL_ACCTG_PERIOD = {">$(=MonthStart(MostRecentAllocation, -11))<=$(=MostRecentAllocation)"},

[Accounting Basis Code]={'STAT'},

[Company Code] = {"*"} - {'06'},

[Report Format] ={'IS'},

[Report Section]={">=100<=700"}

>}Amount)*-1)

where most recent allocation is the end of last month, '9/31/14'

why would this produce a number in a text box, but in a line chart you get "No Data to Display"

6 Replies
MK_QSL
MVP
MVP

IF you share your apps or sample data would be helpful to give you answer.

Not applicable
Author

Well the underlying issue is I have an expression  with an if statement: if(count(Month)>1, Sum{<>}, Sum{<>}), it works in a text box, returns the accurate number, but in the line chart it gives this, can anyone get If statements to work in a line chart

Anonymous
Not applicable
Author

What dimension(s) do you have? Would it return a value in the line chart if you removed the dimension(s)?

PS: I have plenty of linecharts with if() statements that work well, to answer your latest question.

Best regards

Nicolai

Not applicable
Author

My dimension is month_year, when I remove the dimension, the chart appears again, but without month_year I cant show the rolling twelve im trying to get, are you supposed to remove the dimension when using conditional logic in the expressions, I'll try to reproduce the data model broken down

Anonymous
Not applicable
Author

Hi

"are you supposed to remove the dimension"

No no, I just wanted to check if it fact would return a number t exclude issues with the expression itself.

Without the app I'll not be able to help further.