# New to QlikView

Discussion board where members can get started with QlikView.

Announcements

Not applicable

## Current value vs Last month & Last Year

Hi,

I'm only using QV since yesterday so most probably this is a newbie question.

In my db I have a month and year field, with some stockvalues. I made a period field :

Date(MakeDate(Year,Month),'MM-YYYY') AS Period, which works fine

Ok, I use this period field now to build a "stock level per month" graph. This gives the following result (= I see what I want to see) :

But now I want to have 2 dashboard charts which gives me the % increase/decrease of

1. current month stocklevel vs last month, and

2. the current month stocklevel vs last year.

so basically i want : sum(this period) / sum(last period) and sum(this period) / sum(same period last year).

how can i do this?

Thanks for the input guys

1 Solution

Accepted Solutions
Not applicable

## Current value vs Last month & Last Year

Hi Jagan, I found by myself what the solution is.

I defined 3 months:

Curr_Mth='10.2011'

Last_Mth='9.2011'

Last_Yr='10.2010'

then, in the current vs last month % diff chart i used the expression,

=(sum(if(Period=\$(Curr_Mth),varPrdVal)))/sum(if(Period=

\$(Last_Mth),varPrdVal))-1

for the vs last year chart i did the same

=(sum(if(Period=

\$(Curr_Mth),varPrdVal)))/sum(if(Period=\$(Last_Yr),varPrdVal))-1

it works, I'm happy for my first QV day

3 Replies
Not applicable

## Current value vs Last month & Last Year

well, i guess, most probably I'll have to keep a variable "Curr_Mth","Last_Mth" and "Last_Yr" and assign the right period to it, then I can do in my chart Curr_Mth / Last_Mth and so on

but I don't know how to do this in QV.

Thanks

MVP & Luminary

## Current value vs Last month & Last Year

Hi,

Can you uplaod the sample file with data.

Regards,

Jagan.

Not applicable

## Current value vs Last month & Last Year

Hi Jagan, I found by myself what the solution is.

I defined 3 months:

Curr_Mth='10.2011'

Last_Mth='9.2011'

Last_Yr='10.2010'

then, in the current vs last month % diff chart i used the expression,

=(sum(if(Period=\$(Curr_Mth),varPrdVal)))/sum(if(Period=

\$(Last_Mth),varPrdVal))-1

for the vs last year chart i did the same

=(sum(if(Period=

\$(Curr_Mth),varPrdVal)))/sum(if(Period=\$(Last_Yr),varPrdVal))-1

it works, I'm happy for my first QV day