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"
Chart macro: Error with chart data
'2012 May' could not be converted to date.
<<<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}

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

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


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

) formatting

<<<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
Community showcase
Published 2 hours ago in Confluence Cloud

Happy holidays from our team to yours!

Hi Community!  2018 was filled with changes for our team, both big and small, and we've taken a lot of time to both celebrate our wins and recognize areas of improvement. One thing that we're a...

67 views 0 7
Read article

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