Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
MP230691
Contributor III
Contributor III

Unique dates in DD-MMM format in x-axis

Hi All,

I have a date field with values like 01/01/2016 till 31/12/2020. I want to show a line graph with current month and prev year same month comparison in line graph with x-axis having date format DD-MMM.

What I want is only single unique DD-MMM date for all respective years.

Currently I have extracted the fields 01-Jan,02-Jan,03-Jan and so on irrespective of their years but the values still shows the duplicate values for these. Like 01-Jan(for 2016),01-Jan(for 2017) and for others as well.

for eg if I hover over 01-Jan , then the measure for current month and last yr same month should show.Alternatively, if i select 01-Jan,then all the related years to which this date belongs to,should be selected.

Any sort of help would be highly appreciated.

Thanks

 

 

 

 

2 Solutions

Accepted Solutions
rachel_delany
Creator II
Creator II

I would create another field in your load script like this:

 

TEXT(NUM(DAY([Date]),'00'))&'-'&TEXT(MONTH([Date'])) AS DayMonth

View solution in original post

MP230691
Contributor III
Contributor III
Author

Hi Rachel,

It worked ! Thanks a lot.:)

View solution in original post

4 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

The issue is related to the date formats. Every time you work with dates, they are uniquely assigned with their respective years. It would be easier to use the fields Year and Month as Dimensions and forget about adding "01-" for each month.

If you calculate the calendar fields in your data, like this:

Calendar:

LOAD

     Date,

     Month(Date) as Month,

    Year(Date) as Year,

...

...

then you could use the fields Year and month as chart dimensions, and you'd get exactly the year over year comparison that you are looking for.

 

Cheers,

MP230691
Contributor III
Contributor III
Author

Hi Oleg,

Thanks for your inputs. Yes i get your point,but that's the requirement that we have to show our data in the date format as the lowest granuality.so that's why need to show DD-MMM format.Please refer the pic attached.01-is the date shown as an example,similarly for every duplicate record like this,the date should be unique and the respective data should be shown in the same point for both(current and prev year),instead of so many dates apart. Pls let me know if i have made my requirement clear.

rachel_delany
Creator II
Creator II

I would create another field in your load script like this:

 

TEXT(NUM(DAY([Date]),'00'))&'-'&TEXT(MONTH([Date'])) AS DayMonth

MP230691
Contributor III
Contributor III
Author

Hi Rachel,

It worked ! Thanks a lot.:)