Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Week number (formatted as yyyy/ww) as dimension

Hi,

I'm trying to use week number on x-axis, but I want the format to be yyyy/ww. Is there a way to achieve this?

I've created a dual where the text part is properly formatted year and week number, and the numeric value is year * 100 + weekNo, but this gives me the numeric value on x-axis instead of the text value that I want.

6 Replies
morganaaron
Specialist
Specialist

May be a silly question, but have you tried using Text([Your Field]) as the dimension if you're holding it as a dual field? Or is there difficulty in relating it to a genuine week number?

Not applicable
Author

text( field ) gives an "No numeric values on x-axis" message.

Anonymous
Not applicable
Author

Did you consider using the week() function?

You can use something like: year(datefield) & '/' & week(datefield)

as dimension.

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

LOAD

*,

Dual(Year(DateFieldName) & '/' & Week(DateFieldName), WeekStart(DateFieldName)) AS WeekYear

FROM DataSource;

Hope this helps you.

Regards,

Jagan.

Anonymous
Not applicable
Author

This is how I am loading this in my script:

date(datefield,'YYYY')&'-'&num(week(datefield),'00') as Year_WeekNum.

If you are using this calculation in the chart dimension as calculated dimension it should also work.

amit_saini
Master III
Master III

Milka ,

Try this:

year(Datefield) & ' / ' &  week(Datefield) as Week_Number

Thanks,

AS