Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

paulyeo11
Valued Contributor II

How to plot X axis YearMonth with CY sales with LY sales ?

Hi All

I like to create the chart 1

My issue is i don't have the expression for LY.

My Objective for create this chart is , so that i am able to compare CY sales vs LY sales by month.

Hope some one can give me the expression. ( Now i using sum(cost) is not correct.

Enclosed my QVW file.

Paul

10 Replies
qlikmsg4u
Valued Contributor

Re: How to plot X axis YearMonth with CY sales with LY sales ?

Use

Month as Dimension

and these are as expressions

sum({<Year = {"$(=Max(Year))"}>}sales) for CY

sum({<Year = {"$(=Max(Year)-1)"}>}sales) for LY

paulyeo11
Valued Contributor II

Re: How to plot X axis YearMonth with CY sales with LY sales ?

Hi K N

Thank you vey much for your offer ,  Your solution for Expression is great , it is what i need.  But Diamension = Month , is not what i need , as i need to put YearMonth , so that i can view not only current year i can view last year also.

Paul

Re: How to plot X axis YearMonth with CY sales with LY sales ?

The application you have shared has only 9 month of data. How do you expect to see anything for LY? Would you be able to share more data points? may be like 24 months of data so that the results can be shown

MVP
MVP

Re: How to plot X axis YearMonth with CY sales with LY sales ?

Hi Paul,

With MonthName it is very difficult to display, you need to change entire datamodel to calculate it in script.

The best and easy solution is to display is use Month in Dimension

Current Year:

Caption: =Max(Year)

Expression: sum({<Year = {"$(=Max(Year))"}>}sales)

Last Year:

Caption: =Max(Year) - 1

Expression: sum({<Year = {"$(=Max(Year)-1)"}>}sales)

Regards,

Jagan.

paulyeo11
Valued Contributor II

Re: How to plot X axis YearMonth with CY sales with LY sales ?

! ! ! !Hi Jagon

Thank you for look at my posting.

My data model have this field Year_n.

I unable to understand how to apply the expression into my chart .

Can you shown ?

Paul

paulyeo11
Valued Contributor II

Re: How to plot X axis YearMonth with CY sales with LY sales ?

Hi Sunny

My data have many month , the chart i display i control it display only 9 month .

Paul

qlikmsg4u
Valued Contributor

Re: How to plot X axis YearMonth with CY sales with LY sales ?

Like this in attached app?

MVP
MVP

Re: How to plot X axis YearMonth with CY sales with LY sales ?

Hi,

Please find attached file for solution.

Regards,

Jagan.

paulyeo11
Valued Contributor II

Re: How to plot X axis YearMonth with CY sales with LY sales ?

Hi Jagan

Thank you very much for your reply again. The solution is not what i want , because the X Axis is not Year Month , So i will try to figure out using other approach.

Paul

Community Browser