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: 
Exciton
Contributor
Contributor

Scatter chart with Year - Week labels on a continous x-axis

Hi!

I've tried searching the community, but couldn't find anything answering this simple question.

By using the output of the function MonthStart (used in the script), one can create a scatter chart with a 'YYYY-MM ' string label on the x-axis, AND simultanously have dates in number format as the values for the x-axis. This results in linear, continous x-axis where the distance between data points in the graph is proportional to the time between the two dates (please see the attached picture). 

As intended function is achieved with MonthStart : both numerical values for tha x-axis and string value for the x-axis labels.As intended function is achieved with MonthStart : both numerical values for tha x-axis and string value for the x-axis labels.

 


My question is: How to make the same chart, but now with 'YYYY-WW' as the label on the x-axis?  The function WeekName returns dual data type (in similarity with MonthStart), but for some reaseon Qlik does not like to display its string value as x-axis label.

YearWeek.PNG

Obs! X-axis needs to be continous, the solution is not to make string values such as 

Year([$(_DateField)]) & '-' & Week([$(_DateField)]).

Many thanks in advance!

Labels (6)
2 Replies
michaelsikora
Contributor III
Contributor III

Hi Exciton,

 

Try adding a calculated dimension like the following. You do this in the dimensions tab under properties.

=date(Year_Week,'YYYY-MM')

Then you can rename the dimension in under label in dimensions.

 

Regards,

 

Mike

Exciton
Contributor
Contributor
Author

Dear Mike!

Thank you for your reply! I have tried your suggestion, but it did not resolve the issue,  the x-axis labels are still displaying the numerical value corresponding to the timestamp (e.g. 43000).

I believe that the Year-Week field that I calculate by using the WeekName function has the propper return data type, please see: 
https://help.qlik.com/enUS/qlikview/12.1/Subsystems/Client/Content/Scripting/DateAndTimeFunctions/we...

The data type should thus not be an issue. In addition, the chart looks as intended when plotting Year-Month, which was created with corresponding function: MonthStart (https://help.qlik.com/en-US/sense/April2019/Subsystems/Hub/Content/Sense_Hub/Scripting/DateAndTimeFu...)