Time Intelligence in PowerBI

  01 Nov 2020
   powerbi

Data Analysis Expressions (DAX) includes time-intelligence functions that enable you to manipulate data using time periods, including days, months, quarters, and years, and then build and compare calculations over those periods.

Time Intelligence in PowerBI

  Handle multiple datetime formats representation using lubridate

  26 Apr 2020
   r

Handling Heterogeneous datetime formats

We`ll be using parse_date_time function of lubridate package.
Multple datetime formats can be passed under orders attribute of the above function as shown below -

library(lubridate)
dates <- c( "1/22/2020 17:00", "2020-02-02 09:43:01", "2/1/2020 11:53")
parse_date_time(dates, orders = c('%Y-%m-%d %H:%M;%S','%m/%d/%Y %H:%M', '%m/%d/%y %H:%M'))

Output -

## [1] "2020-01-22 17:00:00 UTC" "2020-02-02 09:43:01 UTC"
## [3] "2020-02-01 11:53:00 UTC"

  Download Data from a github folder using httr package in R

  24 Apr 2020
   r

Import Libraries and Request to the master branch of git

The following chunk of code, import required libraries and request the master branch of the required git repository.

library(httr)
library(tidyverse)

req <- GET("https://api.github.com/repos/CSSEGISandData/COVID-19/git/trees/master?recursive=1")
req

Output -

## Response [https://api.github.com/repos/CSSEGISandData/COVID-19/git/trees/master?recursive=1]
##   Date: 2020-04-24 08:14
##   Status: 200
##   Content-Type: application/json; charset=utf-8
##   Size: 88.9 kB
## {
##   "sha": "###############################",
##   "url": "https://api.github.com/repos/CSSEGISandData/COVID-19/git/trees/65ba...
##   "tree": [
##     {
##       "path": ".gitignore",  
##       "mode": "100644",
##       "type": "blob",
##       "sha": "##############################",
##       "size": 9,
## ...