Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

show last 12 month data with the difference from last month

hi all,

i need to show the line chart, which have two dimension, one is month, and other is itemtype,

i need to show the values of last 12 month according to selection.

the value which need to be show is the diffrence from last month,

for example,

for month=11/2014, i have to show the data of 2014/11-2014/10(diffrence of these month value)

month=10/2014, i have to show the data of 2014/10-2014/09(diffrence of these month value) respectivley.


For showing last 12 month i am using the formula:

sum({<yearmonth={'<=$(=max(yearmonth))>=$(=addmonths(max(yearmonth),-11))'}>}amount)

its giving me the values of last 12 month.

i already tried using above() function,

but when i use the second dimension in a line chart the value starts getting incorrect.

Its urgent.


with Regards

Harshita gaur

8 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

Is your number of second dimension values fixed?

Not applicable
Author

yes the va;lue is fixed i have total 7 type of items.

and i already tried making expression for every type.

but its giving me a problem, i can't select a type according to selection, every time all the six value appear.

CELAMBARASAN
Partner - Champion
Partner - Champion

You could try like this

RangeSum(sum({<yearmonth={'<=$(=max(yearmonth))>=$(=addmonths(max(yearmonth),-11))'}>}amount), Above(sum({<yearmonth={'<=$(=max(yearmonth))>=$(=addmonths(max(yearmonth),-11))'}>}amount), 7))

Not applicable
Author

i tried using the above formula, i am getting the value of the latest month, not the difference from last month.

CELAMBARASAN
Partner - Champion
Partner - Champion

Seems like i misunderstood something. Could you please share sample file and describe required result

Not applicable
Author

hi ,

I cant share the original file but i made a demo one, in this file, when i select a month from the list box it will generate the last 12 month of cost. In this example i find the actual amount of that month for the particular type, but i want to generate the difference from last month for that particular month .

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this expression

Rangesum(Above( sum({<month1= {'<=$(=AddMonths((Max(month1)),0))  >=$(=Addmonths((Max(month1)),-11)) '}>}cost)),

-  sum({<month1= {'<=$(=AddMonths((Max(month1)),0))  >=$(=Addmonths((Max(month1)),-11)) '}>}cost))

Regards,

jagan.

Not applicable
Author

Hi jagan,

Actually it's getting me the correct values, except for the first line.

But it will genrate the wrong values, when i use a line chart.

regards

Harshita Gaur