Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join us at the Cloud Data and Analytics Tour! REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
Touix
Contributor III
Contributor III

Sales Analysis by Week for Y / Y-1

Hello,

I am new on Qlik sorry in advance if my question is a silly one; I resume the work of my collegue and I have some questions

I want to have an indicator with a tachymeter that give me the ratio between the sales of the year until the week I want to analyse comparing to the last year for the same period. 

Indeed, I want to select the Year, the Month and the number of the week, and I have the sum of the sales for this period.

I want to compare it with the previous year.

My Data id simple : only One table with : date, number of sale per day.

Option 1 : Add the number of the week into the data set via the expression weekday. But I do not want to touch my qvd.

Option 2 : Add a variable to calculate the number of week. via SET v_WEEDAY = Weekday(Shop.Date,0) and create a selection to choose this variable after choosing a year and a date.

In my dataset I have Shop.DATE_YYYY, DATE_MM, already calculated

But when I do something like this and choose Year shop.DATE_YYYY and Month hop.DATE_MM in my selection box.... I can not retrieve the week number. When I select the entire date (means shop, )

Is it normal ?

Sorry I am new. do you have any question is I was not clear ? Thank you.

2 Replies
edwin
Specialist III
Specialist III

i would add a week number.  so where the week is selected, you can store the week number in a variable.  also you can store the year in a variable

in set analysis you can use {<YEAR={$(vSelectedYear)}, WEEKNUMBER={"<=$(SelectedvWeek)"} ...>} for current year

{<YEAR={$(=vSelectedYear-1)}, WEEKNUMBER={"<=$(SelectedvWeek)"} ...>} for prior year


edwin
Specialist III
Specialist III

you wont need to modify your QVD you can get the week number using the week function on the date, look at the week function as it gives you some option how to configure start of week, etc..
week - script and chart function ‒ QlikView
add that to your load statement

testing a number is easier that testing for a date and calculating it at the same time