Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

paulyeo11
Valued Contributor II

How can i know my sales for CY last Quarter compare with LY ?

Hi All

I have 2 Expression which work fine for last 5 year , when I place these at expression and dimension = year , it will plot for me bar chart year sales trend by YTD or Month , now I want to add last Quarter compare.

Below expression will give me bar chart for 2015 July compare with 2014 July sales. ( Because now us july 2015 )

(sum(-sales * Year2Date(date, year-Year(Today()), Ceil(Month(Today())/3)*3-2)))/1000

Below expression will give me bar chart for 2015 jan - July compare with 2014 Jan - July sales. ( Because now us july 2015 )

money(sum(-sales * YearToDate(date, year-Year(Today())))/1000,$(vMoneyFormatK))

How to modify the above expression , so that I can get sales of Q2 2015 compare with Q2 2014 ?


Hope some one can give me advise.


Paul

1 Solution

Accepted Solutions
kavita25
Valued Contributor

Re: How can i know my sales for CY last Quarter compare with LY ?

Hi,

Try the below expression in back end:

let vDateToday = num(today());

InQuarter(Date_Field,$(vDateToday),-1)* -1 as CYQ2

InQuarter(Date_field, $(vDateToday), -5) * -1 AS LYQ2

Hope it helps you.

Regards,

Kavita

3 Replies

Re: How can i know my sales for CY last Quarter compare with LY ?

Have a look on this: Previous YTQ, QTD, MTD and WTD

- Marcus

kavita25
Valued Contributor

Re: How can i know my sales for CY last Quarter compare with LY ?

Hi,

Try the below expression in back end:

let vDateToday = num(today());

InQuarter(Date_Field,$(vDateToday),-1)* -1 as CYQ2

InQuarter(Date_field, $(vDateToday), -5) * -1 AS LYQ2

Hope it helps you.

Regards,

Kavita

paulyeo11
Valued Contributor II

Re: How can i know my sales for CY last Quarter compare with LY ?

Hi Kavita

thank you it work

Paul

Community Browser