How to Create a GitHub-like Contribution Chart

This post is a guide on how to create a Github contribution chart using Heatmap visual


GitHub's contribution chart is a popular way to visualize activity over time, showing daily contributions. You can create this chart using our Heatmap visual in Power BI.


Data Requirements

Your dataset should contain at least two columns:

  • Date: The date of the activity
  • Value: Number of commits, contributions, or any metric you want to visualize

Import Heatmap Chart visual in PowerBI

The first step is to import Heatmap visual in Power BI. You can acquire heatmap visual from:

  • standalone pbiviz downloaded file from the website
  • or from AppSource
  • or as a part of your suite purchase deployed in organization repository

Once you decide the source of acquisition, you can import the visual following this documentation


Add Fields to the visual

  • Map the Date field to the Tooltip

  • Create a New visual calculation with following DAX formula:

    Weekday = FORMAT([Date], "ddd")
    

    Visual calculation

  • Map Weekday to Vertical Axis

  • Create another visual calculation with following DAX formula:

    Week Number = WEEKNUM([Date], 2)
    

    Note: The parameter 2 ensures week starts from Monday, similar to GitHub's layout

  • Map Week Number to Horizontal Axis

  • Map activity data field Value to Color Value

  • Map Year to Small Multiple. This will create individual heatmaps for each year.

Once completed, your mappings will look like this:

Data Fields mapping


Sorting

Click on the ellipse in the top-right section of the visual and sort data by Date in ascending direction:

Heatmap Sorting


Formatting

  • Color axis: Select the required color scale from Color axis -> Color -> Color Scale. If you want to define your custom colors for color scale you can do so by defining your colors in Color axis -> Custom color.

    Color formatting

  • Vertical axis: Invert axis is switched on. Vertical axis

  • Small multiple: Configure Small multiple properties under Format visual -> Small multiple:

    • Direction is Top to Bottom.
    • Set the Max Rows/Columns to 1.
    • Set Labels to Bold, Horizontal align to Center and Vertical align to Top Small multiple
  • Scroll: Enable Vertical scroll under Chart -> Scroll behavior

    Scroll formatting


Result

This configuration will create a github-like heatmap where:

  • Y-axis represents day of the week
  • X-axis represents week number
  • Color intensity shows the level of activity
  • Multiple years can be displayed using small multiple

The final visualization will closely resemble GitHub's contribution chart, making it perfect for tracking daily activities, commits, or any time-based metrics.


Github Heatmap


← blogs