Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Comparing selected data with previous data

Hi Guys,

I have a table with Revenue numbers with dates and months. I want to compare the selected Revenue numbers with the previous Revenue numbers. (SELECTED_REV / PREVIOUS_REV)

For eg. if i have selected Mar then I would like to Compare Revenue in March compared to Revenue in Feburary (MAR_REV / FEB_REV). If the user sellects March and April then it should be compared with Jan and Feb.

I dont want to hard code it for any fixed duration. Any ideas?

6 Replies
kaushik_solanki
Not applicable

Re: Comparing selected data with previous data

Hi,

     Try below function to get the previous month data.

     Consider you have Month,Year and Date as field name.

     Sum{<Month = {"$(=month(addmonths(Max(Date),-1)))"},Year=,Date=>}Sales)

Regards,

Kaushik Solanki    

Not applicable

Re: Comparing selected data with previous data

Thanks Kaushik,

This works for  a single selection but when I choose multiple months then it doesnt give the correct answer. The QVW file is attached.

Regards

kaushik_solanki
Not applicable

Re: Comparing selected data with previous data

HI,

     Its right. This expression will be for one month selection only.

     what you exactly want to do, will you please describe with example.

Regards,

Kaushik Solanki

Not applicable

Re: Comparing selected data with previous data

I want to find the percentage increase in Sales. So if the user selects Feb then it should display the percantage growth of sales over Jan (this can be done with the expression you provided).

However the user will also be selecting multiple months. Lets say Apr, May and June. In this case i want to see Sales of Jan, Feb and Mar so i can find out the percentage growth of sales.

Gysbert_Wassenaar
Not applicable

Re: Comparing selected data with previous data

You can try using the above function. This has one disadvantage: the first selected month can't be compared with the previous one. If you need that you'll have to create an 'AsOf' table. See attached qvw for both options.


talk is cheap, supply exceeds demand
Not applicable

Re: Comparing selected data with previous data

Thanks. You guys have somewhat answered the question but it still doesnt work with multiple selections. But ill try to make this work