Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi ,
It would be great if anyone can help me on this :
I want to fetch data from sales force (few tables row count) ,For that I am usng R script (SOQL) as a data source in power BI.
When I try to run the script which is given below ,it is throwing an error
start_time <- Sys.time()
library(salesforcer)
library(dplyr, warn.conflicts = FALSE)
library(httpuv)
library(tidyverse)
library(readr)
library(odbc)
library(DBI)
library(dplyr)
library(stringr)
library(tidyr)
library(tidytext)
library(textdata)
library(tm)
library(purrr)
library(tibble)
library(openxlsx)
library(taskscheduleR)
#sf_auth()
username <- "nmurphy@analytics.demo" # normal email/sflogin
password <- "YOUR_SF_PASSWORD+YOUR_TOKEN"
instanceURL <- "https://login.salesforce.com/"
# Account table count
# ---------------------------------------------------
SFDC_Account_Daily <- sf_query(soql = "SELECT COUNT (Id),
day_in_month(CreatedDate),
calendar_month(CreatedDate)
FROM Account
WHERE IsDeleted = False AND CreatedDate=THIS_MONTH
GROUP BY day_in_month(CreatedDate),
calendar_month(CreatedDate)")
# Drop the attributes Column
SFDC_Account_Daily <- within(SFDC_Account_Daily, rm(attributes.type))
# Rename columns to meaningful names
SFDC_Account_Daily <- SFDC_Account_Daily %>%
rename(
Count = expr0,
Date = expr1,
Month = expr2)
# ---------------------------------------------------
# Account table count end
# SD_Project table count
# ---------------------------------------------------
SFDC_SD_Project_Daily <- sf_query(soql = "SELECT COUNT (Id),
day_in_month(CreatedDate),
calendar_month(CreatedDate)
FROM pse__Proj__c
WHERE IsDeleted = False AND CreatedDate=THIS_MONTH
GROUP BY day_in_month(CreatedDate),
calendar_month(CreatedDate)")
# Drop the attributes Column
SFDC_SD_Project_Daily <- within(SFDC_SD_Project_Daily, rm(attributes.type))
# Rename columns to meaningful names
SFDC_SD_Project_Daily <- SFDC_SD_Project_Daily %>%
rename(
Count = expr0,
Date = expr1,
Month = expr2)
Error :
i think you are complicating this for yourself, one solution to this will be to use some tool like windsor.ai to get data from salesforce to power bi.
https://windsor.ai/microsoft-power-bi-salesforce-report-dashboard-template/
Thank you for your update .We wont be able to use external application to fetch the data.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!