Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to Calculate sum of Sales of a Previous week

Good Day.

I'm trying to calculate sum of Amount.

[View:http://community.qlik.com/cfs-file.ashx/__key/CommunityServer.Discussions.Components.Files/674/3806.SalesAmount.docx:550:0]

i have two straight tables (ST1 and ST2)

in ST1 i want to show calculated value of Amount of current week that i click(for ex 2008/31). I calculate it by a formula: sum(Amount). And we see that dimension (week(opDate)) is also 31. ok.

But in ST2 i want to calculate Amount for the previous week.

Formula is: sum({$<Week={"(=Week(opDate-7))"}>}Amount)

But as the result i have got the same values in ST2 and ST1. But dimensions a ddifferent(31 and 30).

How to calculate in one table current(clicked) week amount,

and second table previous week amount.

And why in my example they are equals?

9 Replies
Not applicable
Author

can you post a QVW with an example of your data?

johnw
Champion III
Champion III

Is the (=Week(...)) supposed to be a dollar sign expansion? Is the dollar sign really missing, or is the version you posted not the same as the version you're using? I'd use single quotes since this is a literal. On a fairly different subject, if you've selected a specific opDate, and if that date is connected to your data, then no matter what you do with week, this expression is STILL looking only for that opDate. You have to add an opDate= to tell it to ignore it. Something like this?

sum({<opDate=,Week={'$(=week(opDate-7)'}} Amount)

Not applicable
Author

i created a test db.

where there is table docJournal.

this table has fields id, opDate, Amount.

Please can u advise me why i am getting different values in dimensions(that wright: i want on table with clikked week and second - with previous week) but the values of Sum(Amount) are different?

How to deal with it?

I've attached the example..

Not applicable
Author

Hello, mr Witherspoon..

I am very appressiated ur help.. so i have only one week experience in qv.. and i ve got no references to make advansed scripts and expressions in qv. so, .. i atttached example of test db in my post, so if u'll hellp me to get tables with previous and current week sales amount data in my attachaed file - it would help me to understand system...

and if u just do the table, where would be field1 - weekNumber,

field2 - salesAmount(of current week) Sc

field3 - sales amount of previous week - Sp

field 4 - deviation(Sc - Sp)

if u give me this pattern, i guess, it will help me to understand the principles of working with qv and making advanced expressions...

the file is attached in my previous post..

thank u.))

Not applicable
Author

Hi,

have a look at the attached QV for the answer to your query

Cheers

Not applicable
Author

Please! Can u sent me file in qlikView personal edition, because i can't open it, it says that acces denied (because i downloaded qlikview from the site - it is not licensed version - it just personal edition)

thank u!

Not applicable
Author

Hi,

you could use formulas as under:

For values of current week = Sum(Amount)

For values of the precious week = Sum (All {$} {$<Week = {$(=Only(Week)-1)}>} Amount )

Not applicable
Author

thank u!)

johnw
Champion III
Champion III


EvgenyGin_J wrote:Please! Can u sent me file in qlikView personal edition, because i can't open it, it says that acces denied (because i downloaded qlikview from the site - it is not licensed version - it just personal edition)


So far as I know, the free version of QlikView simply doesn't let you open files created by other people. We can't modify those files in a way that would let you open them. I believe only QlikTech themselves could do so. Think of it as copy protection, perhaps. Your version doesn't have permission to use the files, and mere licensed users like ourselves don't have the ability or permission to remove the copy protection. That's my basic understanding, anyway.