Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to calculate Last year Sales

Hi All,

I am building a Qlikview App and i have to do TY Sales Vs LY Sales for a month .To calculate LY sales i have created 2 new variables as

vmaxDateIDLY = DateId_LY ( which gives the last year date)

vLY_CurrDate = [Fiscal Year]=, [Fiscal Qtr]=, [Fiscal Half]=, [Fiscal Month]=, [Week End]=,Date=, [Fiscal Week]=, [FiscalWeekDesc]=, DateId={$(vmaxDateIDLY)}

And inside the expression i have something like this

sum({$<$(vLY_CurrDate)>}Sales) .

The output i get is i see a new row in the bottom for the LY date of current date with the sales and remaining all dates as zero's.However if i pick a single date then i get a new row on the top of select date which has last year date and sales .

How do i get the LY sales in the same row rather than getting a new row?

Thanks

24 Replies
Not applicable
Author

The above example gives me sales for Ty in both the columns, i want to have the sales for last year in 2 column.

thanks

Not applicable
Author

does this not work:

=sum({$<DateId_Ly=>} ExtNetDollars)

that should show the netdollors for last year

Not applicable
Author

Hi thomas,

Sorry it does give this year sales only , Can you plese send me the qvw with last year sales? Maybe i am missing something?

Thanks

Not applicable
Author

For me it makes right i think, but maybe im not understanding it properbly

Not applicable
Author

Hi Thomas,

It still gives the same values for TY and LY .I think you might be confused with the expression for this year sales, so i just made it sum of sales and if you see the attached QVW now both of them are same. Can we have such that the second column has the sales for LY?

Thanks

Not applicable
Author

Ohhh i see.

I dont think i can help you, but hope someone can!

As far as i can see - You have a fact tables with ExtDollors on Dates from this Year, related to a dimension with dates from this year, which then relates to dates from last year.

If you try to make two straight tables. One with sum(extDollors) on DateId and one on DateId_Ly you will see that the sum is the same, but on the different dates. Therefore you will always have the same result.

Does your fact table have sums on last year data or do you only have last year in your dimensions?

Look at this: Its the same sum for both, even though im on last year and this yearCapture.PNG.png

Not applicable
Author

Hi Thomas,

Sorry actually i limited the sales to greater than 20130801 now i changed it to 20110701 . Can you please take a look at it now and see if we can achieve LY sales

Thanks

Not applicable
Author

hi where did you the attach the new file?

Not applicable
Author

hi Thomas,

Sorry i forgot the attachment, Here it is

Thanks

Not applicable
Author

Hi thomas,

Sorry i forgot the attachment, Here it is.

thanks