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

compare data with month from previous year

Hello, I'm relatively new at Qlikview and wanted to compare some data from a selected year with its previous year.

In Qlikview I have a table in which i show the count of all the contacts there have been with the customer per mount [=count(contactsID)] with the dimension [contacts.month]

I want to show an other expression with the contacts with customers in the same month a year before.

So if my table shows all the contacts from jan-2014 until dec-2014 I want a bar next to every month with the months jan-2013 until dec-2013

for example jan-2013/jan-2014; feb-2013/feb-2014; etc

If anybody could help i would be very grateful! Thanks to all of you in advance!

1 Solution

Accepted Solutions
Not applicable
Author

Add expression as:

count({<contact.year={$(=contact.year-1)}>}ContactID

regards

Darek

View solution in original post

10 Replies
Not applicable
Author

In this chart you have also year as dimension, or maybe your contacts.month field has year-month information?

Not applicable
Author

sorry for not being clear about that!

In the database i have a date field and in Qlikview i load that as

Load

date as contact.date

year(date) as contact.year,

month(date) as contact.month,

day(date) as contact.day,

so contact.month is the month of the date in the database.

Not applicable
Author

TOm,

but as you told, you have selected year (i expect, one selected year).

So, your expression:

=count(contactsID)

gives you result for selected year and for months from your chart dimension.

Now if you would like to have also expression for year-1 you may use set analysis.

Find attached example.

regards

Darek

tresesco
MVP
MVP

If you are using time as dimension, two ways I can see:

  • Script: Create a monthly aggregated field for last year using previous/peek function on ordered data
  • Front end: Using a complex logic with synthetic dimension (ValueLoop()/ValueLis()) and expression using

        Pick(Match(

The suggested one is script-way.

Not applicable
Author

In qlikview i made a selection option for years. If you select 2014 i want the table to show 2014 and 2013. The table has the dimension {Contact.Month} and the expresion {count(ContactID)} as you can see below

qlikview.jpg

Not applicable
Author

ps. i have only a personal version. so i can't open your file. Sorry for that :$

Not applicable
Author

Add expression as:

count({<contact.year={$(=contact.year-1)}>}ContactID

regards

Darek

Not applicable
Author

Thank you very much!!!

MWiciok
Creator
Creator

Hi,

you can use two expressions in your diagramm:

  1. count(contactsID)
  2. count({$ <contact.year={$(=only(contact.year) - 1)}>} contactsID)

The second expression uses set-analysis (the part in the {}-brackets).