So I have been playing with this one widget for a few days and I can't seem to filter it right to get what I want on a line chart.
We do an Art Happy Hour every Thursday night over the summer that is free to attend for everyone (members, non-members, doesn't matter). It's from end of May to beginning of September.
I would like a line graph that shows year over year, so Summer 2022 on one line, Summer 2023 on a second, etc.
I need it to go in date order (so left to right May - September) on the x axis with the labels of each Thursday by date (so 8/3/23, 8/10/23, 8/17/23, etc.)
My problems start because of when our Fiscal Year is. Our FY is July 1 to June 30, which is smack-dab in the middle of Art Happy Hour's run. Either because of Fiscal Year or some other filter, the months seem all out of wack (it'll start with August, then go to May, then September, before going back to June and July).
Can someone tell me what I have to put on the X axis, value, and break by in order to get what I want?
Here is a screenshot of the dashboard and the filters currently. I'd show you it flipped to a line graph, but it gets really wonky.
Hi Chelsea,
Given that the date in the prior year's Thursday for the given week of 2023 will be different, would you expect the 8/4/22 numbers to render against the 8/3/23 axis label? If that's okay, then you could use Weeks in Performance Date instead of the fields you current have on Categories, and change the date formatting to show MM/dd/yy, and then we could apply a script (at the end of this post) to the widget to adjust that label to 3 days later.
Then instead of using a Break By, use a duplicate of the Ticket Attended Count and apply the PREV() function, to return the count from 52 weeks prior...
( [Total Ticket Count] , PREV( [Weeks in Performance Date] , 52 ) )
In order for this to work, the Calendar Month filter is also replaced by the same Performance Date field that is on Rows/Categories, but grouped by Month with only 05/2023 through 08/2023 selected.
Note that the scripts behind these widgets that change the date to Thursday for the given week are different between the Pivot and Bar (Bar version works for Line, Column, Area) charts.
Pivot
widget.on('ready', function(){ $.each($("tbody .p-head-content span",element), function(){ var span = this.textContent; var new_date = new Date(span); new_date.setDate(new_date.getDate() + 3) new_date = (new_date.getMonth()+1) +'/'+ new_date.getDate()+ '/'+ new_date.getFullYear(); this.textContent = new_date; }); });
Bar
widget.on('processresult', function(widget, args ){ var dates = args.result.xAxis.categories; var new_dates = []; dates.forEach(function(category){ var new_date = new Date(category); new_date.setDate(new_date.getDate() + 3); new_date = (new_date.getMonth()+1) +'/'+ new_date.getDate()+ '/'+ new_date.getFullYear(); new_dates.push(new_date) }); args.result.xAxis.categories = new_dates; });
WeeklyThursdayTY_2D00_LY.dash