skip to main content
Power BI
    • What is Power BI
    • Why Power BI
    • Customer stories
    • Data visuals
    • Security
    • Power BI Desktop
    • Power BI Pro
    • Power BI Premium
    • Power BI Mobile
    • Power BI Embedded
    • Power BI Report Server
  • Pricing
    • Azure + Power BI
    • Microsoft 365 + Power BI
    • Dynamics 365 + Power BI
      • Energy
      • Healthcare
      • Manufacturing
      • Media
      • Retail
    • For analysts
    • For IT
      • Overview
      • Embedded analytics
      • Power BI visuals
      • Automation
      • Documentation
      • Community
    • Getting started
      • Overview
      • Self-guided learning
      • Webinars
      • Documentation
      • Roadmap
      • Overview
      • Issues
      • Give feedback
    • Blog
    • Business intelligence topics
    • Overview
    • Forums
    • Galleries
    • Submit ideas
    • Events
    • User groups
    • Community blog
    • Register
    • ·
    • Sign in
    • ·
    • Help
    Go To
    • Microsoft Power BI Community
    • Welcome to the Community!
    • News & Announcements
    • Get Help with Power BI
    • Desktop
    • Service
    • Report Server
    • Power Query
    • Mobile Apps
    • Developer
    • DAX Commands and Tips
    • Custom Visuals Development Discussion
    • Health and Life Sciences
    • Power BI Spanish Community
    • Translated Spanish Desktop
    • Power Platform Integration - Better Together!
    • Power Platform Integrations
    • Power Platform and Dynamics 365 Integrations
    • Training and Consulting
    • Instructor Led Training
    • Galleries
    • Community Connections & How-To Videos
    • COVID-19 Data Stories Gallery
    • Themes Gallery
    • Data Stories Gallery
    • R Script Showcase
    • Webinars and Video Gallery
    • Quick Measures Gallery
    • 2021 MSBizAppsSummit Gallery
    • 2020 MSBizAppsSummit Gallery
    • 2019 MSBizAppsSummit Gallery
    • Events
    • Ideas
    • Custom Visuals Ideas
    • Issues
    • Issues
    • Events
    • Upcoming Events
    • Community Engagement
    • T-Shirt Design Challenge 2023
    • Community Blog
    • Power BI Community Blog
    • Custom Visuals Community Blog
    • Community Support
    • Community Accounts & Registration
    • Using the Community
    • Community Feedback
    cancel
    Turn on suggestions
    Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
    Showing results for 
    Search instead for 
    Did you mean: 
    • Microsoft Power BI Community
    • Galleries
    • R Script Showcase
    • Heatmaps

    Heatmaps

    09-15-2016 02:19 AM - last edited 09-15-2016 02:26 AM

    fathomson
    Advocate II
    40717 Views
    LinkedIn LinkedIn Facebook Facebook Twitter Twitter
    fathomson
    fathomson Advocate II
    Advocate II
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    Heatmaps

    ‎09-15-2016 02:19 AM

    heatmap.JPG

     

    Description

    An heatmap is a graphical representation of data where the individual values contained in a matrix are represented as colors. This R script shows an heatmap of calls received during the week. Based on the the timestamps it calculates the count per weekday/hour. 
      

    Prerequisites (The sample .pbix files will not work without these prerequites completed)

    1. Install R Engine

    Power BI Desktop does not include, deploy or install the R engine. To run R scripts in Power BI Desktop, you must separately installR on your local computer. You can download and install R for free from many locations, including the Revolution Open download page, and the CRAN Repository.

     

    2. Install the required R packages.

    Download the R script attached to this message and run it to install all required packages on your local machine. 

     

    Required R packages:

    dplyr, ggplot2, ggthemes, zoo


    Tested on:

    CRAN 3.3.1, MRO 3.3.0, powerbi.com

     

     

    Preview file
    51 KB
    heatmaps_in_powerbi_with_r.pbix
    Labels:
    • Labels:
    • General R Visualizations
    Message 1 of 8
    40,717 Views
    7
    Reply
    • All forum topics
    • Previous Topic
    • Next Topic
    fathomson
    fathomson Advocate II
    Advocate II
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎10-31-2016 07:53 AM

    @Anonymous Looks nice and thanks for adding the R installation script!

     

    @vrocca Thanks! In R studio I usually use the install.packages('packagename') to add a new package. And above your script or markdown document library('packagename')

     

     

    Message 5 of 8
    39,996 Views
    0
    Reply
    Anonymous
    Not applicable
    In response to fathomson
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎07-02-2018 10:25 PM

    Hi @fathomson, 

     

    I'm new to R and just installed Microsoft R Open onto my laptop. I have also downloaded the rscript. However, when I click on Packages->Install Packages....this appears ( see attached). 

     

    I think I'm perhaps doing it wrong. Ultimately, I need the 2 dimension heat map to be on powerbi so that I can use it on my data. I'm a bit confused as to how to go about this so would be great if you could list down a step by step guide to this. 

     

     

    Thanks,

    Lina

    Preview file
    29 KB
    Message 8 of 8
    34,876 Views
    0
    Reply
    Anonymous
    Not applicable
    In response to fathomson
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎07-02-2018 10:23 PM

    Hi @fathomson, 

     

    I'm new to R and just installed Microsoft R Open onto my laptop. I have also downloaded the rscript. However, when I click on Packages->Install Packages....this appears ( see attached). 

     

    I think I'm perhaps doing it wrong. Ultimately, I need the 2 dimension heat map to be on powerbi so that I can use it on my data. I'm a bit confused as to how to go about this so would be great if you could list down a step by step guide to this. 

     

     

    Thanks,

    Lina

    Preview file
    29 KB
    Message 7 of 8
    34,876 Views
    0
    Reply
    Sclark
    Sclark
    Frequent Visitor
    In response to fathomson
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎09-05-2017 12:07 PM

    Is there any way we could change this from a count per hour / day. To an average count per hour / day?

    Message 6 of 8
    37,932 Views
    0
    Reply
    Anonymous
    Not applicable
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎10-25-2016 11:25 PM

    I wish I'd seen this posting before I started my example...Smiley Happy

     

    My version uses the same ggplot and geom_tile functions as @fathomson but, rather than use R to massage the data with dplyr etc., it links directly to fields dragged from PBI - a typical Date dimension column and uses a calculated Time Bucket column as the other dimension against which to map the Call Count measure.  I DO use the  'complete' function from the 'tidyr' package to fill in missing values and avoid holes in the heatmap.

     

    I also played with presenting the value of the measure on the tile and some other formatting options.  I tried to use the viridis palette package, but it's not supported on PBI Service yet.

     

    Required R packages: ggplot2, ggthemes, tidyr. (see attached R script)

    Matrix HeatmapMatrix Heatmap

     

     

     

     

    Matrix Heatmap.pbix
    ScriptInstallPackagesForMatrixHeatmap.R
    Message 3 of 8
    40,171 Views
    0
    Reply
    vrocca
    vrocca Advocate IV
    Advocate IV
    In response to Anonymous
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎10-28-2016 12:52 PM

    Here are the links to download the packages referenced:

     

    dplyr: https://cran.r-project.org/src/contrib/dplyr_0.5.0.tar.gz

    ggplot2: https://cran.r-project.org/src/contrib/ggplot2_2.1.0.tar.gz

    ggthemes: https://cran.fhcrc.org/src/contrib/ggthemes_3.2.0.tar.gz

    zoo: https://cran.r-project.org/src/contrib/zoo_1.7-13.tar.gz

     

    Alternatively, you can install these throug R Studio by clicking on Packages > Install and entering the name of the package.

     

    Hope that helps.

    Thanks,
    Victor Rocca | www.victorrocca.com
    Message 4 of 8
    40,122 Views
    0
    Reply
    mike_honey
    mike_honey Memorable Member
    Memorable Member
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎09-21-2016 07:12 PM

    There doesnt appear to be any R script attached to this topic?

    Message 2 of 8
    40,532 Views
    0
    Reply

    Power Platform

    • Overview
    • Power BI
    • Power Apps
    • Power Pages
    • Power Automate
    • Power Virtual Agents

    • Sign in
    • Sign up

    Browse

    • Solutions
    • Consulting Services

    Downloads

    • Power BI Desktop
    • Power BI Mobile
    • Power BI Report Server
    • See all downloads

    Learn

    • Guided learning
    • Documentation
    • Support
    • Community
    • Give feedback
    • Webinars
    • Developers
    • Blog
    • Newsletter

    © 2023 Microsoft

    Follow Power BI

    • Privacy & cookies
    • Manage cookies
    • Terms of use
    • Trademarks
    Consumer Privacy Act (CCPA) Opt-Out Icon Your Privacy Choices