Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Now Live: Qlik Sense SaaS Simplified Authoring – Analytics Creation for Everyone: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

previous year comparison

Hi Experts,

I have a bar chart showing recent 13 weeks' sales value.

my dimension is Yearweek.

it is showing the current week 2015-25 till the past 12 weeks.

now, i need to show the comparison of the same 13 weeks for the last year sales in the chart.

how can i do this.

pls help....

1 Solution

Accepted Solutions
swuehl
MVP
MVP

See attached your calendar integrated in my previous example.

View solution in original post

19 Replies
swuehl
MVP
MVP

You can change the dimension to a Week dimension, then create two expressions, one for this year, one for previous year.

To help you more, especially with some dimension sorting issues that can arise, please post a small sample QVW.

giakoum
Partner - Master II
Partner - Master II

Not applicable
Author

Hi swuehl,

I have done the dimension as week and the expressions for current year and previous year.

but i have to make chart for the recent 13 weeks. i.e., current week is 25. so week 25 to....week 13(this year and previous year)

but now when i give the dimension limits to first 13 and sorting descending, i m getting week 52,51,50.....which is not the requirement.

attached the chart for reference.

pls help....

Not applicable
Author

any other suggestions plssssss

swuehl
MVP
MVP

Maybe like attached as a starting point.

I am still thinking about how to solve the sorting when you cross year bounderies looking 12 weeks back in time (i.e. jumping in week number).

Not applicable
Author

Hi Swuehl,

thanks for the response.

but my weekstart is every saturday.

My calendar is set as

Set vCal_FD = 5; // First Day of the week {0=Mon, 1=Tue, ... , 6=Sun}

WeekStart(TempDate, 0, $(vCal_FD) ) as WeekStart

and my expression is

sum({<Week = {">=$(=Weekstart(today(),-12, $(vCal_FD))<=$(=weekstart(today(),0, $(vCal_FD)))"}>}Amount)

but i m not getting the values

Pls help me on this

how should i use my expression

swuehl
MVP
MVP

I think you need to use field WeekStart in your set modifier:

sum({<WeekStart = {">=$(=Weekstart(today(),-12, $(vCal_FD))<=$(=weekstart(today(),0, $(vCal_FD)))"}>}Amount)

Not applicable
Author

ok

now the expression looks fine.

but dimension...

i have taken week

but its having 52 weeks

how this is possible and i have done only for 2015.

it is showing sales value as well for these 52 weeks which is not correct.

pls help me to limit the dimension.

                 My calendar 

               TempDate AS Date,

               NUM(TempDate) AS NumDate,

               WeekStart(TempDate, 0, $(vCal_FD) ) as WeekStart ,

               Week(TempDate) as Week,

               Year(TempDate) As Year, 

               Month(TempDate) As Month, 

               MonthName(TempDate) As MonthYear,

balkumarchandel
Specialist II
Specialist II

I will suggest use week no. as separate column in script which will just contain 1,2,3,4,5,etc

the in your set expression use current week and current year for current year expression and

same expression for previous year but use year = currentyear -1

Thanks

BKC