Chart macro: Error with chart data 'XX' could not be converted to date

Hi all,
I have a series of MySQL queries in Confluence, and I'm using a time series chart with them.

I updated some of the code, and now all of the charts are broken, with the error "'2012 May' could not be converted to date". There is one chart that is unbroken, but when I copy the exact code, that duplicate code then has a broken chart. It's quite confusing.

I've posted the code below, along with the exact error. It's supposed to count up new plans sold, and display in a graph by month. Please help!
Please note: "Event_date" is in format "2012-05-09 10:12:40"
<<<START ERROR>>>
Chart macro: Error with chart data
'2012 May' could not be converted to date.
<<<END ERROR>>>
<<<START CODE>>> (Note: Some sensitive data scrubbed)
{chart:type=timeSeries|timePeriod=Month|columns=1,2,3,4,5|dateFormat=yyyy MMMM|dataOrientation=vertical|dataDisplay=true|legend=true|width=1000|height=300|opacity=90}
{sql-query:dataSource=XX\|output=wiki}

SELECT
CONCAT(Year, ' ', Month) AS "Month",
`Plan 1`,
`Plan 2`,
`Plan 3`,
`All Plans`
FROM (

select year(event_date) as "Year", Monthname(event_date) as "Month",
sum(if(plan_id = 1,1,0)) as "Plan 1",
sum(if(plan_id = 2,1,0)) as "Plan 2",

sum(if(plan_id = 3,1,0)) as "Plan 3",
sum(if(plan_id in(1,2,3),1,0)) as "All Plans",

FROM `XX`.`XX`

where event_type = "create"
group by 1,2
order by 1 desc, month(event_date) desc

) formatting

{sql-query}
{chart}
<<<END CODE>>>

1 answer

Perhaps this was just you copying into the question, but don't split dateFormat across 2 lines.

Yea the code is "dateFormat=yyyy MMMM"...think the copy & paste here wrapped it.

Create a chart macro example with with just a row or 2 of regular data copy/pasted from the sql to show a simple version of your problem so it can be reproduced easily.

Problem fixed. Your initial hunch was right. There was a line break in dateFormat. But, in the Confluence editor, it was appearing as a space, so it wasn't clear there was a line break.

The text editor here picked it up, but I thought that was just text box wrap.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Friday in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

301 views 11 10
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you