Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
bharatkishore
Creator III
Creator III

Previous Week

Hi All,

I have a week column from excel and i have  sales and super sales... Now i need show data for previous week.

The formula for calculating is sales/supersales for previous week.

Can you please help me on this.

Thanks,

Bharat

12 Replies
Anonymous
Not applicable

your weekfield is a datefield, so you Need to define a new field

for example:

Sales:
load * Inline [
Brand, Week, Sales, SuperSales
A, 12.07.2015, 2836, 118
A, 14.12.2015, 2242, 106
A, 21.12.2015, 3751, 147
]
;

left join(Sales)
load *,
week(Week) as WeekNr
Resident Sales;

then you can use this Expression:

=sum({<WeekNr={'$(=max(WeekNr)-1)'}>}Sales/SuperSales)

you my use eitehr Week  or WeekNr as dimension

if you use a mastercalendar (the best choice anyway) you may Need the weekfield from mastercalendar

bharatkishore
Creator III
Creator III
Author

Thanks a lot

Not applicable

Hi,

In scripting,

Sales:

LOAD Brand,

     Week,

     Sales,

     [Super Sales],

     week(Week) as WeekNum

FROM ....

In expression,

=sum({<weeknum={'$(=max(weeknum)-1)'}>}Sales/[Super Sales])

-Joyson G