Display months as words instead of numbers

hcsavage
Participant I

I am currently trying to display Months in a word format instead of a number format for a tile. 

681db739-bbde-4cd6-984d-5ad8a531467d.png

Above is what it looks like right now and I want it to say JAN-DEC instead.

This is what the table calculation is:

ed211397-c9b5-4886-9e9e-9ecf8240b7df.png

This is what the entire tile looks like data wise: 

69b4fff1-f072-4a33-be43-7fe631c5ed3f.png

Below is the Reporting Date Month custom dimension”

90da346d-3c94-4bdb-84a4-6043de4e73ae.png
Solved Solved
1 3 3,783
1 ACCEPTED SOLUTION

Dawid
Participant V

Final solution would look like this:

 

concat(
if(min(${reporting_date_month}) = 1,
"January",
if(min(${reporting_date_month}) = 2,
"February",
if(min(${reporting_date_month}) = 3,
"March",
if(min(${reporting_date_month}) = 4,
"April",
if(min(${reporting_date_month}) = 5,
"May",
if(min(${reporting_date_month}) = 6,
"June",
if(min(${reporting_date_month}) = 7,
"July",
if(min(${reporting_date_month}) = 8,
"August",
if(min(${reporting_date_month}) = 9,
"September",
if(min(${reporting_date_month}) = 10,
"October",
if(min(${reporting_date_month}) = 11,
"November",
"December"
)
)
)
)
)
)
)
)
)
)
),

" through",

if(max(${reporting_date_month}) = 1,
"January",
if(max(${reporting_date_month}) = 2,
"February",
if(max(${reporting_date_month}) = 3,
"March",
if(max(${reporting_date_month}) = 4,
"April",
if(max(${reporting_date_month}) = 5,
"May",
if(max(${reporting_date_month}) = 6,
"June",
if(max(${reporting_date_month}) = 7,
"July",
if(max(${reporting_date_month}) = 8,
"August",
if(max(${reporting_date_month}) = 9,
"September",
if(max(${reporting_date_month}) = 10,
"October",
if(max(${reporting_date_month}) = 11,
"November",
"December"
)
)
)
)
)
)
)
)
)
)
)
)

View solution in original post

3 REPLIES 3

Dawid
Participant V

Unfortunately, there’s no easy way to work with lists or array. You would have to create a cascaded IF statement that returns the name of the Month based on a number.. something along these lines:

if(${month_num} = 1, "January",
if(${month_num} = 2, "February",
...

and you’d have to do it on both sides of the string

n_davis
Participant V

I created a constant in a manifest file for this scenario (which you then just @ the constant value in the html like     html: @{standard_date_format} ;;) - you could also just update the html directly

constant: standard_date_format {
value: "
{% if _field._name contains 'month' %}
{{ rendered_value | append: '-01' | date: '%b %Y' }}
{% else %}
{{ rendered_value }}
{% endif %}
"
}

Dawid
Participant V

Final solution would look like this:

 

concat(
if(min(${reporting_date_month}) = 1,
"January",
if(min(${reporting_date_month}) = 2,
"February",
if(min(${reporting_date_month}) = 3,
"March",
if(min(${reporting_date_month}) = 4,
"April",
if(min(${reporting_date_month}) = 5,
"May",
if(min(${reporting_date_month}) = 6,
"June",
if(min(${reporting_date_month}) = 7,
"July",
if(min(${reporting_date_month}) = 8,
"August",
if(min(${reporting_date_month}) = 9,
"September",
if(min(${reporting_date_month}) = 10,
"October",
if(min(${reporting_date_month}) = 11,
"November",
"December"
)
)
)
)
)
)
)
)
)
)
),

" through",

if(max(${reporting_date_month}) = 1,
"January",
if(max(${reporting_date_month}) = 2,
"February",
if(max(${reporting_date_month}) = 3,
"March",
if(max(${reporting_date_month}) = 4,
"April",
if(max(${reporting_date_month}) = 5,
"May",
if(max(${reporting_date_month}) = 6,
"June",
if(max(${reporting_date_month}) = 7,
"July",
if(max(${reporting_date_month}) = 8,
"August",
if(max(${reporting_date_month}) = 9,
"September",
if(max(${reporting_date_month}) = 10,
"October",
if(max(${reporting_date_month}) = 11,
"November",
"December"
)
)
)
)
)
)
)
)
)
)
)
)
Top Labels in this Space
Top Solution Authors