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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Terry_Che
Contributor II
Contributor II

How to compare two year data in line chart with DDMMM X axis?

Dears, I'm comparing two year's data with same period, e.g. "9/26/2023-10/9/2023 vs 9/26/2024-10/9/2024". 

I'm trying to use line chart to deal with it. 

What I want to show is something like this.

Terry_Che_0-1730169917301.png

 

But I got this instead.

Terry_Che_1-1730170030845.png

 

Would you please help me with that?

 

Labels (3)
1 Solution

Accepted Solutions
Terry_Che
Contributor II
Contributor II
Author

Thanks, Lisa!

But it doesn't work on my dashboard.

Terry_Che_0-1730267348369.png

 

I found a solution by below expression making the X axis show the same year. But I feel like I'm cheating.

=DATE(MakeDate(2024,MONTH([TKT FLT DATE.autoCalendar.Date]),DAY([TKT FLT DATE.autoCalendar.Date])),'ddMMM')

 

Terry_Che_1-1730267766840.png

 

View solution in original post

9 Replies
Lisa_P
Employee
Employee

You need to create a dimension for the day/month using an expression like this for your 1st dimension:

=Day([TKT FLT DATE]) &'-'& [TKT FLT DATE.autoCalendar.Month]

and add [TKT FLT DATE.autoCalendar.Year] as a second dimension to split into years

Terry_Che
Contributor II
Contributor II
Author

Thanks for your reply.

We know the date values in Qlik are dual values. But such text like operation will remove the numeric value of the date. 

 

Day([TKT FLT DATE]) &'-'& [TKT FLT DATE.autoCalendar.Month]

 

Then, the sorting will be a mess as following.

Terry_Che_0-1730182863495.png

Lisa_P
Employee
Employee

Mine sorted ok by opening sort and turn off the alphabetical sort

Terry_Che
Contributor II
Contributor II
Author

Thanks, Lisa!

But it doesn't work on my dashboard.

Terry_Che_0-1730267348369.png

 

I found a solution by below expression making the X axis show the same year. But I feel like I'm cheating.

=DATE(MakeDate(2024,MONTH([TKT FLT DATE.autoCalendar.Date]),DAY([TKT FLT DATE.autoCalendar.Date])),'ddMMM')

 

Terry_Che_1-1730267766840.png

 

marcus_sommer

I think I would use a calendar-dimension approach like this one:

dual(date(DATE, 'DD.MM'), daynumberofyear(DATE)) as DateWithoutYear

ramazanerduran
Partner - Contributor III
Partner - Contributor III

Hi @Terry_Che,

 

Create a new column on Master Calendar, that is include day and month long name seperated. Then use it on line chart as a dimension. 

Then use set expression for selecting years on calculations, then it will be done.

 

Thanks,

Ramazan

Terry_Che
Contributor II
Contributor II
Author

Hi @marcus_sommer , @ramazanerduran 

 

Many thanks for your replies. 

Unfortunately, I don't have the access to manage the scripts and master items. So I have to use the chart functions to achieve this.

 

Thanks,

Terry

marcus_sommer

Then go to the team who is responsible for the data-model that the calendar is appropriate extended - all kind of period-related fields has to be there - even if it were several dozens string/number/dual-variants of dates/month/yearmonth and all kinds of counters and flags to calendar/working-days and so on.

As far as any UI dimension/expression needs the combining/extracting/replacing/formating of period-information it's a lack of the data-model with a negative impact to the usability and performance.

Terry_Che
Contributor II
Contributor II
Author

Thanks, Marcus. I've raised my request.

At present, to continue my dashboard, I'll use the alternative solution.

Thanks for your help!