WOW2020 Week 21: Can you design for an automatic phone layout?
This challenge from Lorna focuses on creating dashboards for use on mobiles. As such, the calculations and worksheets are not complicated. It’s all about the dashboard formatting.
Lorna links to a handy article from Bridget Cogley, which gives some tips. I think the main idea here is to build the default dashboard layout in such a way that Tableau’s automatic layout feature converts the dashboard successfully into a mobile format.
Lorna set her public solution such that it can only be seen properly on a mobile device (or mobile simulator on the desktop). On the challenge page, the dashboard looks like this:
The mobile version is essentially one on top of the other.
- The dashboard has two containers next to each other
- Bridget’s comments about putting all filters on the first chart makes sense, as this will be the first chart displayed on a phone
- No floating containers!
The Build
This looks like three sheets stacked one above the other for sales and profit.
The graphs mention Year To Date, but as the data set goes to the end of 2019, and “To Date” makes no sense here, I’m going to be lazy and hard code the date calculations to save time to focus on the primary challenge.
The first chart is Sales for 2018 and 2019 with comparisons to the year before. Year of Order date to Rows and SUM(Sales) to Text, then reversing the sort order gives:
Drag SUM(Sales) to the marks card again, using the dropdown on the pill, select Quick Table Calculation, then again and select Relative to Next gives:
Selecting 2016 and 2017 and selecting hide leaves just the data I’m looking for:
Year to colour, rotate (year) labels, hide field labels for rows, drag to increase the gap between the numbers and format the table calc as Custom, “▲0%;▼0%”, edit title, get rid of row dividers and we’re done:
The Sales over time chart was also very straightforward, completed in around a minute, including formatting:
Next the bar chart of top ten customers by sales. Actually, looking closer, it’s actually the top ten products, so I’ll go with that. I created a filter of Product Name, top 10 by SUM([Sales]). Again very quick:
Profit YTD and Graph, were pretty much just duplications of the sales graphs:
The Top 10 / bottom 10 products by profit bar chart involved creating two sets and combining them.
Right click on Product Name, Create, Set, Top 10 by profit:
Then the same again for Bottom 10. Then select both sets in the Fields Panel, click the dropdown of one and select Create Combined Set with all members of both sets:
Product name to Rows, SUM([Profit]) to Columns and the combined set from above to filters, plus sorting and formatting gives:
But how to get the Top 10 / Bottom 10 labelling of the original? Looks like a calculated field is needed:
Drag this to rows, add a bit of formatting and we have what we want.
The Dashboard
I created vertical and horizontal containers and filled them with the worksheets above, one Text block for the title, and one blank for spacing, something along these lines:
I created vertical and horizontal containers and filled them with the worksheets above, one Text block for the title, and one blank for spacing, something along these lines:
When viewed in standard mode, the result looks like this:
I selected the Phone Layout:
…and it completely ignored my vertical containers and just put them in from top left, across, to bottom right:
Way to go Tableau!
Then I remembered something I’d seen in a video somewhere. As long as you have all of the constituent parts in the default view, you can edit the other views by clicking on the three dots to the right of the secondary view, in this case, Phone. Then you can drag the components around to create the desired effect:
It seems a bit stupid that Tableau ignores the carefully structured containers when automatically creating the mobile view, but I’ve thought for a long time that layout is one of Tableau’s weakest areas.
Never mind, job done!
…or at least I thought it was, Although the dashboard is rendered as wanted in Tableau itself, looking at it on public using my mobile, it only shows the first sales sheet. Looks like the feature needs some work. Looking forward to seeing how Lorna got around this bugginess.
Addendum
Lorna had added something so that the dashboard it only visible on a phone and not in a PC browser. I just had to give that a go too.
All I did was to float a couple of Text blocks and an image in front of the dashboard in the default layout. As these elements are not in the mobile view, they are simply ignored when viewing on your phone.
Edit: Addendum