Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join this live chat April 6, 10AM EST - QlikView to Qlik Sense REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
oscarmqz
Creator III
Creator III

Two years in same chart by day?

Hi all, hope you can help me, I have a line chart that has a date as dimension which is already in format MMM-dd in load script. I'm showing the current count based on selections and I want to add a second line with last year data at same dates but something is not working, the chart split the dates as if they had a year, see the example.

Capture.JPG.jpg

here are my expressions:

CY: =count(if(Source='Letters',[Sales Letter ID]))

LY: =count({<FY={$(=FY-1)}>}  if(Source='Letters',[Sales Letter ID]))

PS: The lines looks the same because is dummy data for CY, which is ok.

1 Solution

Accepted Solutions
geert_gelade
Creator
Creator

It's an new field, but only de formatting is changed.

I changed the dimension in the chart to the expression in the picture. To see different lines, I multiplied the last year count with 2 and the sorting is according to [Report Date].

monthday.jpg

monthday2.jpg

If you don't want to use a calculated dimension, you can put it in the script.

View solution in original post

9 Replies
geert_gelade
Creator
Creator

I think the year is still in your date, it's just a format.

When you put the month-date combination in a separate field, it should work.

oscarmqz
Creator III
Creator III
Author

Hello, it is in a separate field just with month-date already

geert_gelade
Creator
Creator

Can you upload a sample.

oscarmqz
Creator III
Creator III
Author

Here you go, thanks!

ecolomer
Master II
Master II

Use Month (without the year) in dimension and use another dimension year

marcarreras
Specialist
Specialist

Oscar,

solution 1:  add month and day fields in the table, and then use these as dimensions

solution 2:  use this expression as calculated dimension:

               =Month([Report Date 2]) & '-' & Day([Report Date 2])

Hope it helps.

Marc.

geert_gelade
Creator
Creator

It's an new field, but only de formatting is changed.

I changed the dimension in the chart to the expression in the picture. To see different lines, I multiplied the last year count with 2 and the sorting is according to [Report Date].

monthday.jpg

monthday2.jpg

If you don't want to use a calculated dimension, you can put it in the script.

View solution in original post

oscarmqz
Creator III
Creator III
Author

Ok, this is partially working, as Jan and Feb dates are mixed, same happened in your example...

oscarmqz
Creator III
Creator III
Author

Ok, solved the sort issue... weird, just added an ORDER BY clause to SQL query in script, the rest is the same. Thanks for your help!