Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

rathnam_qv
Contributor

Line Chart Current Year Vs Last Year

Hi All,

PFA image.

I have a line chart showing current year trend and previous trend.

But the issue is with current year trend. For current year i am taking JAN to OCT but the line is connecting to NOV and DEC with the value 0.

i don't want to connect it to Nov and Dec. i have selected the option "Show as gaps" also still it is not working as expected.

My Expression for Current Year  --  sum({<Year={'$(Max(Year))'}>}values)

Can anyone suggest me how to resolve it.

Thanks in advance.

Rathnam.

1 Solution

Accepted Solutions
kulwantsaj219
Contributor II

Re: Line Chart Current Year Vs Last Year

if(sum({<Year={'$(Max(Year))'}>}values)=0,null(),sum({<Year={'$(Max(Year))'}>}values))  write this expression and in add on tab uncheck include zero value

6 Replies
rohitlohani
New Contributor III

Re: Line Chart Current Year Vs Last Year

hello muniratham ,

for current year u can this expression

Sum({<OrderDate={">=$(=(YearStart(Max(OrderDate))))<=$(=Max(OrderDate))"},Year=,Month=>} [values])

and for previous year u can use this expression,

Sum({<OrderDate={">=$(=(YearStart(Max(OrderDate),-1)))<=$(=YearEnd(Max(OrderDate),-1))"},Year=,Month=>} [values])

hope it will work,

regards

Rohit lohani

sahadevpatil
New Contributor III

Re: Line Chart Current Year Vs Last Year

Hi,

In my app if current year Oct Nov values are zero then its not shows Trend on those Month

I have attached  QVW , pls check

Regards

kulwantsaj219
Contributor II

Re: Line Chart Current Year Vs Last Year

if(sum({<Year={'$(Max(Year))'}>}values)=0,null(),sum({<Year={'$(Max(Year))'}>}values))  write this expression and in add on tab uncheck include zero value

rathnam_qv
Contributor

Re: Line Chart Current Year Vs Last Year

Hi Kulwant,

Thank You very much. It's works for me.

Thanks,

Rathnam.

mdmukramali
Valued Contributor II

Re: Line Chart Current Year Vs Last Year

Hi,

Attached Sample working apps,

maybe helpful to some others,

Thanks,

Mukram

armela_veizi
New Contributor

Re: Line Chart Current Year Vs Last Year

Hi, I see the post is a bit old, but may I ask you how did you manage to put in the line graph both current and previous year lines? I am having troubles with finding the right formula to do this, it either shows me the current year and previous all zero or both is given the same value.

Here is what I'm using as formulas:

C.Y: sum({$ <  YearMonth={"<=$((Month(Today())))"}, Year={"<=$((Year(Today())))"}  >}[Orders])

L.Y : sum({$ <   YearMonth={"<=$(( YearMonthPrevious))"} >}[Orders])

Thanks in advance!

Community Browser