Display months as words instead of numbers

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

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

This is what the table calculation is:

This is what the entire tile looks like data wise:

Below is the Reporting Date Month custom dimension”

1 Like

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

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} ;:wink: - 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 %}
  "
}

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"
                      )
                    )
                  )
                )
              )
            )
          )
        )
      )
    )
  )
)