Calendar Heatmap without breaks between months

Version 7

    Description:

    The most straightforward way to make a calendar heat map leaves odd blank spots at the boundaries of the months if you use Month(Date) as a dimension on a row or column shelf to get a Month label. So if a month ends on Wed and thus the next month starts on Thursday, then there will be holes at the end of the first month and at the start of the next month until the heat map restarts.


    This workbook shows how to get a calendar heat map with month labels without getting those odd breaks, by using a table calculation to create the labels


    Screenshot


    Before (with holes between months)

    cal_heatmap_old_way.jpg


    After (without holes between months)

    Cal_Heat_Map.jpg

    Implementation

     

    The trick is the following calculated field which first finds the lowest numbered day of the month in each week using window_min(), and then checks whether it falls within a 7 day range (set here to run from the 4th to the 11th). That test determines which which weeks (columns) will get a a label other than the empty string. When you do call datename() to create a label, you need to use window_max() instead of window_min() in case the week being labelled has days from more than one month.

     

    // adjust the range to any 7 day period to adjust where the month label appears

    if window_min(min(datepart('day', [Order Date]))) >= 4 and

       window_min(min(datepart('day', [Order Date]))) < 11 then

      left(datename('month', window_max(max([Order Date]))), 3)

    else

      ""

    end

    The rest just involves formatting to get the font size and cell size working well and to turn off borders between column headers (and of course to not show the header for week number).

     

    The only thing missing from the d3 example below is a bold jagged border on the cell boundaries that separate months. That would be really useful, but I don't see a way to do that within Tableau (but would love to be proven wrong)

     

    d3 example screenshot

    d3_calmap.tiff

    http://mbostock.github.io/d3/talk/20111018/calendar.html

     

    Tableau Version: 9.0


    Original Author: Alex Blakemore