SlideShare a Scribd company logo
Yana Berkovich Data Platform MVP
@yana_Berkovich
YanaBerkovich.com
Seattle CODECAMP
DAX & SQL in PowerBI
About Me
BI Analyst& DEV, Microsoft Data Platform MVP
Consultant, Product Manager
BusinessIntelligenceand Data Visualization Consultant
https://www.linkedin.com/in/yanaberkovich
http://yanaberkovich.com
@Yana_Berkovich
AGENDA
• What is PowerBI?
• Where can we find the data?
• SQL
• DAX
• DAX editor tool
• Creating Slicers sample
POWER PLATFORM
What is PowerBI?
A suite of business analytics tools that deliver insights.
Data processing and data visualization tool
https://powerbi.microsoft.com
Audience: Business Users & Managers
Users: IT, Finance, HR, Marketing, Manufacturing,
Data Analysts…
WHAT ARE WE USING POWERBI FOR?
Connect to Data
sources
Create Reports/
dashboards/
Applications
Collaborate and
Share
Data Insights
HOW DOES IT WORK?
Who can Edit?
How and who access Data Source
Templates and custom visuals to use
On Prem
DB
Who can consume
Similar across devices
Special authentication
Design
Data Integrity
Scheduled
connections
WHAT IS CURRENTLY PART OF POWERBIPower BI desktop
Power BI Desktop is the report authoring tool - https://powerbi.microsoft.com/en-us/desktop
Access data from various data sources and transform them for your reporting needs
Power BI Service – Pro/ Premium (Capacity, Licensing and Monitoring)
Browser based portal - https://app.powerbi.com
Share and collaborate with your collogues and wider audience
PowerBI Report Server
On premise solution for organizational reporting
PowerBI Mobile
Mobile Application, can be connected to your PowerBI on premise or the cloud
PowerBI Data Gateway
Install in your organization, to enable secure data connection (same as for PowerApps)
Embedded Analytics
PowerBI in Azure, set powerBI when needed, in the Azure portal
Use PowerBI REST API & JS to embed in your applications
PowerPlatform AI builder
Melissa Coates –
https://www.coatesda
tastrategies.com
@SQLChick,
visualized it so much
better! So let’s review
Dax & sql in power bi
THE MOST IMPORTANT THING….
Ask WHY???
Why are we doing this visualization?
What is the business question
ADVENTUREWORKS
Sample Data Base and Data Warehouse by Microsoft
Contains retail sales and customers data
In reporting, we prefer the denormalized star schema data warehouse
that has fact tables and dimension tables to create the reports quickly
STAR
Schema
SNOWFLAKE
Schema
WHAT ARE WE GOING TO DO?
ETL PowerBI style
Extract
•Connect to the DW
•Get the Data
Transform
•SQL query
•PowerBI editor
•DAX query
Load
•Cache the data as part of model
•Direct Query option
CREATING YOUR DATA SOURCE
Azure Portal (1st year trial period, students plans… )
NEW -> Data Warehouse
Data warehouse – first create service or use an existing one
(Details were in todays session: Building a better data solution: Microsoft SQL Server and
Azure Data Services
Joseph Dantoni)
Sample DB
Adventure
Works
Creating
the server
if needed
PLAY AND PAUSE
I can resume or stop the server
It cost me a Starbucks Latte
to get this demo running 
pause your data warehouse
when you are not using it
SECURITY….
Don’t forget to add your
IP or configure security settings to be able to connect to your Server
Sample unable to connect error in PowerBI
GETTING THE DATA
• Desktop: Online:
DATA CONNECTIONS
• There are 230+ various built in data
connections for the PowerPlatform
• We are working with Azure SQL DW today
named:AdventureWorks
CONNECTING
• Adding the servers name will connect to
the server: YanaAdventure
• Authentication:
– Next screen logging in
– In the SQL statement box as a full
connection string
• Data Transformation
– Inside the PowerBI editor
– In the SQL statement box (Select, from,
where/join/sort/top…)
Select * from DimOrganization
Where CurrencyKey = 1
DW: Adventure
THE DATA SOURCE SETTINGS
WHERE TO CONNECT
The data source
settings and
permissions for
accessing a single or
multiple data sources
can be configured
using this screen
SQL & TSQL
• TSQL statements are used to perform the transactions to the databases. TSQL is
mainly used to build the application logic.
• SQL is a programming language which focuses on managing relational databases. T-
SQL is a procedural extension used by SQL Server
(www.complexsql.com )
• In Power BI
– We can write SQL queries
– When we get and transform the data we can do it manually or write a SQL query
– It is actually TSQL… since we are building the application logic
ON PREMISE – DATA GATEWAY
We are using Azure
SQL DW in the cloud,
but what if our SQL
DW / DW was on
premise?
DATA SOURCES – HOW TO CONNECT?
• Install data gateway – Why do we need data Gateway?
– Personal data Gateway – not for organizations, will not work for other users
– Organizational/on premise– set with organizational user – password expiry and security
– Configure the gateway in the report refresh, to avoid entering credentials
• Create Application user
– Enable organizational access, set the user to access the data source (SQL)
• Data Refresh
– Online - Defined on the Data Set not the individual report or dashboard
– Report Server on premise – Access and permissions are defined on the folder level
– Gateway has to be online and reachable – is your machine on?
• Direct Query Access – Online Synchronization
– Same user that is creating the PowerBI report has to publish it (Application or Admin)
– A report can have multiple data sources,
– A report cannot be Direct Query and multiple data source
– Direct Query report has to have only 1 data base/source to access!
THE POWER OF EXCEL - POWERQUERY
• Power Query - cleansing and shaping the data – shape your data before load
• Power Pivot - modelling and reporting
Power Query also provides a Custom Connectors SDK so that third parties can create their
own data connectors
PowerBI is built on top of those 2 queries
2 great resources for PowerQuery and excel Training:
https://exceleratorbi.com.au/shaping-modelling-power-bi/
ExcelGuru in Vancouver
THE ERD
• Fact tables
– Sales & Resales transactions
• Dimension tables:
– Customers
– Geographic location
– Date
– Product
– Product Category
• Cardinality
– 1 to 1
– 1 to M
– M to 1
– M to M
• Direction
– 1st table filters 2nd
– 2nd table filters 1st
– Both
SHOULDN’T WE JUST CREATE A VIEW
IN SQL?
• YES! – but it is not always possible – DBA might not be on your side
• Not always the best option if it is for certain visualizations
• Maybe you just want a fragment of the data
• Performance will improve on the PowerBI side if you do, but there are additional
resources back in SQL
WHAT IS DAX?
DAX is a formula language.
Used to define custom calculations
for Calculated Columns and for
Measures (also known as calculated
fields)
Includes some of the Excel functions
+ Aggregations
Helps get the most out of your data
THE DAX EXPERTS
• The Definitive Guide to DAX
Marco Russo & Alberto Ferrari
DAX tools –
https://www.sqlbi.com/tools/
HOW DO I EDIT & LEARN DAX?
• Visual studio extension
• PowerBI
• DAX editor By Marco Russo
Microsoft:
• https://docs.microsoft.com/en-us/dax/dax-function-reference
Marco Russo
https://www.sqlbi.com/author/marco-russo/
In tools you can find everything you need to develop DAX queries, download and use for
debugging
DAX STUDIO FOR POWERBI
Download the DAX studio to
analyze and check your DAX
queries in PowerBI designer
From www.SQLBI.com website built by
Marco Russo & Alberto Ferrari, free for
download
R U N N I N G A D A X Q U E R Y T O C R E AT E
T H E R E F E R E N C E S L I C E R T A B L E
WHAT CAN WE DO?
• Select and calculate the number of distinct rows –
The Business Question: How many different currencies the company is currently
supporting?
Answer:
Diffrent Currency = COUNTROWS(DISTINCT(FactResellerSales[CurrencyKey]))
= COUNTROWS(DISTINCT(FactResellerSales[ResellerKey]))
OR built in PowerBI visual that does the same
CREATING A COMPLEX DAX QUERY
FOR SLICER TABLE
• What happens if we want to slice by
more than one dimension?
• Option 1 3 different filters in
PowerBI
• Option 2 DAX query to create a
slicer table
• Option 3 Manually creating a table
• Option 4 Creating a SQL table/view
Dax & sql in power bi
MORE DEV OPTIONS
• M – for most of the queries that contain a TSQL statement inside the query
• Json
– creating the custom themes for your report
– Building custom visuals, the visual part
• Python
– Using the custom editor to create data analytics with Python scripting
– Working with Azure ML studio
– Creating Python visuals
• R
– Using the custom editor to create data analytics with R scripting
– Creating R visuals
– Working with Azure ML studio
SUMMARYE
• Connecting to
the DW
• Authentication
• Sample view
T
• Query Editor
• SQL query
• DAX Query
• DAX editor
L
• Load
• Exploring the
data
• visualizations
*,* slicer
• Column vs
calculation
• Connection
tables
IMPORTANT LINKS FOR THE FUTURE:
DAX reference Microsoft:
Marco Russo & the tools
Guy in a cube & Patrick – for everything that is new and exciting
PowerBI.com
PowerBI blog
Ad

More Related Content

What's hot (20)

Data Mesh
Data MeshData Mesh
Data Mesh
Piethein Strengholt
 
Building a modern data warehouse
Building a modern data warehouseBuilding a modern data warehouse
Building a modern data warehouse
James Serra
 
Power BI for Developers
Power BI for DevelopersPower BI for Developers
Power BI for Developers
Jan Pieter Posthuma
 
DAX and Power BI Training - 001 Overview
DAX and Power BI Training -  001 OverviewDAX and Power BI Training -  001 Overview
DAX and Power BI Training - 001 Overview
Will Harvey
 
Free Training: How to Build a Lakehouse
Free Training: How to Build a LakehouseFree Training: How to Build a Lakehouse
Free Training: How to Build a Lakehouse
Databricks
 
Working with Microsoft Power Business Inteligence Tools - Presented by Atidan
Working with Microsoft Power Business Inteligence Tools - Presented by AtidanWorking with Microsoft Power Business Inteligence Tools - Presented by Atidan
Working with Microsoft Power Business Inteligence Tools - Presented by Atidan
David J Rosenthal
 
Power BI
Power BIPower BI
Power BI
Stéphane Fréchette
 
Azure Synapse Analytics Overview (r2)
Azure Synapse Analytics Overview (r2)Azure Synapse Analytics Overview (r2)
Azure Synapse Analytics Overview (r2)
James Serra
 
Microsoft power bi
Microsoft power biMicrosoft power bi
Microsoft power bi
techpro360
 
Power BI Overview
Power BI Overview Power BI Overview
Power BI Overview
Gal Vekselman
 
Snowflake Datawarehouse Architecturing
Snowflake Datawarehouse ArchitecturingSnowflake Datawarehouse Architecturing
Snowflake Datawarehouse Architecturing
Ishan Bhawantha Hewanayake
 
Data Lakehouse, Data Mesh, and Data Fabric (r1)
Data Lakehouse, Data Mesh, and Data Fabric (r1)Data Lakehouse, Data Mesh, and Data Fabric (r1)
Data Lakehouse, Data Mesh, and Data Fabric (r1)
James Serra
 
Power BI Overview
Power BI OverviewPower BI Overview
Power BI Overview
Nikkia Carter
 
Introduction to Azure Data Lake
Introduction to Azure Data LakeIntroduction to Azure Data Lake
Introduction to Azure Data Lake
Antonios Chatzipavlis
 
Monitoring your Power BI Tenant
Monitoring your Power BI TenantMonitoring your Power BI Tenant
Monitoring your Power BI Tenant
Angel Abundez
 
Moving to Databricks & Delta
Moving to Databricks & DeltaMoving to Databricks & Delta
Moving to Databricks & Delta
Databricks
 
Architect’s Open-Source Guide for a Data Mesh Architecture
Architect’s Open-Source Guide for a Data Mesh ArchitectureArchitect’s Open-Source Guide for a Data Mesh Architecture
Architect’s Open-Source Guide for a Data Mesh Architecture
Databricks
 
Microsoft Power BI
Microsoft Power BIMicrosoft Power BI
Microsoft Power BI
Geetika
 
Power bi
Power biPower bi
Power bi
Lakshmi Prasanna Kottagorla
 
Microsoft Power BI Overview
Microsoft Power BI OverviewMicrosoft Power BI Overview
Microsoft Power BI Overview
Netwoven Inc.
 
Building a modern data warehouse
Building a modern data warehouseBuilding a modern data warehouse
Building a modern data warehouse
James Serra
 
DAX and Power BI Training - 001 Overview
DAX and Power BI Training -  001 OverviewDAX and Power BI Training -  001 Overview
DAX and Power BI Training - 001 Overview
Will Harvey
 
Free Training: How to Build a Lakehouse
Free Training: How to Build a LakehouseFree Training: How to Build a Lakehouse
Free Training: How to Build a Lakehouse
Databricks
 
Working with Microsoft Power Business Inteligence Tools - Presented by Atidan
Working with Microsoft Power Business Inteligence Tools - Presented by AtidanWorking with Microsoft Power Business Inteligence Tools - Presented by Atidan
Working with Microsoft Power Business Inteligence Tools - Presented by Atidan
David J Rosenthal
 
Azure Synapse Analytics Overview (r2)
Azure Synapse Analytics Overview (r2)Azure Synapse Analytics Overview (r2)
Azure Synapse Analytics Overview (r2)
James Serra
 
Microsoft power bi
Microsoft power biMicrosoft power bi
Microsoft power bi
techpro360
 
Data Lakehouse, Data Mesh, and Data Fabric (r1)
Data Lakehouse, Data Mesh, and Data Fabric (r1)Data Lakehouse, Data Mesh, and Data Fabric (r1)
Data Lakehouse, Data Mesh, and Data Fabric (r1)
James Serra
 
Monitoring your Power BI Tenant
Monitoring your Power BI TenantMonitoring your Power BI Tenant
Monitoring your Power BI Tenant
Angel Abundez
 
Moving to Databricks & Delta
Moving to Databricks & DeltaMoving to Databricks & Delta
Moving to Databricks & Delta
Databricks
 
Architect’s Open-Source Guide for a Data Mesh Architecture
Architect’s Open-Source Guide for a Data Mesh ArchitectureArchitect’s Open-Source Guide for a Data Mesh Architecture
Architect’s Open-Source Guide for a Data Mesh Architecture
Databricks
 
Microsoft Power BI
Microsoft Power BIMicrosoft Power BI
Microsoft Power BI
Geetika
 
Microsoft Power BI Overview
Microsoft Power BI OverviewMicrosoft Power BI Overview
Microsoft Power BI Overview
Netwoven Inc.
 

Similar to Dax & sql in power bi (20)

Using Power BI and Azure as analytics engine for business applications
Using Power BI and Azure as analytics engine for business applicationsUsing Power BI and Azure as analytics engine for business applications
Using Power BI and Azure as analytics engine for business applications
Digital Illustrated
 
Module_01_formation-PowerBI Desktop.pptx
Module_01_formation-PowerBI Desktop.pptxModule_01_formation-PowerBI Desktop.pptx
Module_01_formation-PowerBI Desktop.pptx
seydi17
 
Power BI
Power BIPower BI
Power BI
Cybage Software Pvt ltd
 
Best practices to deliver data analytics to the business with power bi
Best practices to deliver data analytics to the business with power biBest practices to deliver data analytics to the business with power bi
Best practices to deliver data analytics to the business with power bi
Satya Shyam K Jayanty
 
Formulating Power BI Enterprise Strategy
Formulating Power BI Enterprise StrategyFormulating Power BI Enterprise Strategy
Formulating Power BI Enterprise Strategy
Teo Lachev
 
Making the Most of Power BI with SQL Server 2014 and Azure
Making the Most of Power BI with SQL Server 2014 and AzureMaking the Most of Power BI with SQL Server 2014 and Azure
Making the Most of Power BI with SQL Server 2014 and Azure
Perficient, Inc.
 
Powerbi 130926080957-phpapp02
Powerbi 130926080957-phpapp02Powerbi 130926080957-phpapp02
Powerbi 130926080957-phpapp02
MILL5
 
Building Modern Data Platform with Microsoft Azure
Building Modern Data Platform with Microsoft AzureBuilding Modern Data Platform with Microsoft Azure
Building Modern Data Platform with Microsoft Azure
Dmitry Anoshin
 
Building your first Analysis Services Tabular BI Semantic model with SQL Serv...
Building your first Analysis Services Tabular BI Semantic model with SQL Serv...Building your first Analysis Services Tabular BI Semantic model with SQL Serv...
Building your first Analysis Services Tabular BI Semantic model with SQL Serv...
Microsoft TechNet - Belgium and Luxembourg
 
SQL Server 2014 Faster Insights from Any Data
SQL Server 2014 Faster Insights from Any DataSQL Server 2014 Faster Insights from Any Data
SQL Server 2014 Faster Insights from Any Data
Stéphane Fréchette
 
Power BI - 2016 - Public
Power BI - 2016 - PublicPower BI - 2016 - Public
Power BI - 2016 - Public
Julian Payne
 
SQL Analytics for Search Engineers - Timothy Potter, Lucidworksngineers
SQL Analytics for Search Engineers - Timothy Potter, LucidworksngineersSQL Analytics for Search Engineers - Timothy Potter, Lucidworksngineers
SQL Analytics for Search Engineers - Timothy Potter, Lucidworksngineers
Lucidworks
 
Self-Service Data Integration with Power Query
Self-Service Data Integration with Power QuerySelf-Service Data Integration with Power Query
Self-Service Data Integration with Power Query
Stéphane Fréchette
 
Microsoft Azure BI Solutions in the Cloud
Microsoft Azure BI Solutions in the CloudMicrosoft Azure BI Solutions in the Cloud
Microsoft Azure BI Solutions in the Cloud
Mark Kromer
 
Bake-off Power BI
Bake-off Power BIBake-off Power BI
Bake-off Power BI
SoHo Dragon
 
Self-Service Business Intelligence with Power BI
Self-Service Business Intelligence with Power BISelf-Service Business Intelligence with Power BI
Self-Service Business Intelligence with Power BI
Theresa Lubelski
 
Microsoft Power Stack 2019 [Power BI, Excel, Azure & Friends]
Microsoft Power Stack 2019 [Power BI, Excel, Azure & Friends]Microsoft Power Stack 2019 [Power BI, Excel, Azure & Friends]
Microsoft Power Stack 2019 [Power BI, Excel, Azure & Friends]
Olivier Travers
 
Power business intelligence
Power business intelligencePower business intelligence
Power business intelligence
aasthabadoniya1
 
Hybrid Analytics in Healthcare: Leveraging Power BI and Office 365 to Make Sm...
Hybrid Analytics in Healthcare: Leveraging Power BI and Office 365 to Make Sm...Hybrid Analytics in Healthcare: Leveraging Power BI and Office 365 to Make Sm...
Hybrid Analytics in Healthcare: Leveraging Power BI and Office 365 to Make Sm...
Perficient, Inc.
 
Perficient Self Service Business Intelligence with Power Pivot
Perficient Self Service Business Intelligence with Power PivotPerficient Self Service Business Intelligence with Power Pivot
Perficient Self Service Business Intelligence with Power Pivot
Perficient, Inc.
 
Using Power BI and Azure as analytics engine for business applications
Using Power BI and Azure as analytics engine for business applicationsUsing Power BI and Azure as analytics engine for business applications
Using Power BI and Azure as analytics engine for business applications
Digital Illustrated
 
Module_01_formation-PowerBI Desktop.pptx
Module_01_formation-PowerBI Desktop.pptxModule_01_formation-PowerBI Desktop.pptx
Module_01_formation-PowerBI Desktop.pptx
seydi17
 
Best practices to deliver data analytics to the business with power bi
Best practices to deliver data analytics to the business with power biBest practices to deliver data analytics to the business with power bi
Best practices to deliver data analytics to the business with power bi
Satya Shyam K Jayanty
 
Formulating Power BI Enterprise Strategy
Formulating Power BI Enterprise StrategyFormulating Power BI Enterprise Strategy
Formulating Power BI Enterprise Strategy
Teo Lachev
 
Making the Most of Power BI with SQL Server 2014 and Azure
Making the Most of Power BI with SQL Server 2014 and AzureMaking the Most of Power BI with SQL Server 2014 and Azure
Making the Most of Power BI with SQL Server 2014 and Azure
Perficient, Inc.
 
Powerbi 130926080957-phpapp02
Powerbi 130926080957-phpapp02Powerbi 130926080957-phpapp02
Powerbi 130926080957-phpapp02
MILL5
 
Building Modern Data Platform with Microsoft Azure
Building Modern Data Platform with Microsoft AzureBuilding Modern Data Platform with Microsoft Azure
Building Modern Data Platform with Microsoft Azure
Dmitry Anoshin
 
Building your first Analysis Services Tabular BI Semantic model with SQL Serv...
Building your first Analysis Services Tabular BI Semantic model with SQL Serv...Building your first Analysis Services Tabular BI Semantic model with SQL Serv...
Building your first Analysis Services Tabular BI Semantic model with SQL Serv...
Microsoft TechNet - Belgium and Luxembourg
 
SQL Server 2014 Faster Insights from Any Data
SQL Server 2014 Faster Insights from Any DataSQL Server 2014 Faster Insights from Any Data
SQL Server 2014 Faster Insights from Any Data
Stéphane Fréchette
 
Power BI - 2016 - Public
Power BI - 2016 - PublicPower BI - 2016 - Public
Power BI - 2016 - Public
Julian Payne
 
SQL Analytics for Search Engineers - Timothy Potter, Lucidworksngineers
SQL Analytics for Search Engineers - Timothy Potter, LucidworksngineersSQL Analytics for Search Engineers - Timothy Potter, Lucidworksngineers
SQL Analytics for Search Engineers - Timothy Potter, Lucidworksngineers
Lucidworks
 
Self-Service Data Integration with Power Query
Self-Service Data Integration with Power QuerySelf-Service Data Integration with Power Query
Self-Service Data Integration with Power Query
Stéphane Fréchette
 
Microsoft Azure BI Solutions in the Cloud
Microsoft Azure BI Solutions in the CloudMicrosoft Azure BI Solutions in the Cloud
Microsoft Azure BI Solutions in the Cloud
Mark Kromer
 
Self-Service Business Intelligence with Power BI
Self-Service Business Intelligence with Power BISelf-Service Business Intelligence with Power BI
Self-Service Business Intelligence with Power BI
Theresa Lubelski
 
Microsoft Power Stack 2019 [Power BI, Excel, Azure & Friends]
Microsoft Power Stack 2019 [Power BI, Excel, Azure & Friends]Microsoft Power Stack 2019 [Power BI, Excel, Azure & Friends]
Microsoft Power Stack 2019 [Power BI, Excel, Azure & Friends]
Olivier Travers
 
Power business intelligence
Power business intelligencePower business intelligence
Power business intelligence
aasthabadoniya1
 
Hybrid Analytics in Healthcare: Leveraging Power BI and Office 365 to Make Sm...
Hybrid Analytics in Healthcare: Leveraging Power BI and Office 365 to Make Sm...Hybrid Analytics in Healthcare: Leveraging Power BI and Office 365 to Make Sm...
Hybrid Analytics in Healthcare: Leveraging Power BI and Office 365 to Make Sm...
Perficient, Inc.
 
Perficient Self Service Business Intelligence with Power Pivot
Perficient Self Service Business Intelligence with Power PivotPerficient Self Service Business Intelligence with Power Pivot
Perficient Self Service Business Intelligence with Power Pivot
Perficient, Inc.
 
Ad

More from Berkovich Consulting (20)

Whats new and exciting jan 22
Whats new and exciting jan 22Whats new and exciting jan 22
Whats new and exciting jan 22
Berkovich Consulting
 
Power automate and power BI January 22 Baku
Power automate and power BI January 22 BakuPower automate and power BI January 22 Baku
Power automate and power BI January 22 Baku
Berkovich Consulting
 
Ai in power platform
Ai in power platform Ai in power platform
Ai in power platform
Berkovich Consulting
 
October2019 release
October2019 releaseOctober2019 release
October2019 release
Berkovich Consulting
 
Visual guidance for power bi toronto pbi tour (1)
Visual guidance for power bi toronto pbi tour (1)Visual guidance for power bi toronto pbi tour (1)
Visual guidance for power bi toronto pbi tour (1)
Berkovich Consulting
 
Power BI as a storyteller
Power BI as a storytellerPower BI as a storyteller
Power BI as a storyteller
Berkovich Consulting
 
August2019 release PowerBI
August2019 release PowerBI August2019 release PowerBI
August2019 release PowerBI
Berkovich Consulting
 
July2019 release
July2019 releaseJuly2019 release
July2019 release
Berkovich Consulting
 
Visual guidance calgary user group
Visual guidance calgary user groupVisual guidance calgary user group
Visual guidance calgary user group
Berkovich Consulting
 
June2019 release
June2019 releaseJune2019 release
June2019 release
Berkovich Consulting
 
Data analytics and powerbi intro
Data analytics and powerbi introData analytics and powerbi intro
Data analytics and powerbi intro
Berkovich Consulting
 
SQL Saturday Redmond The Power Platform
SQL Saturday Redmond The Power Platform SQL Saturday Redmond The Power Platform
SQL Saturday Redmond The Power Platform
Berkovich Consulting
 
Visual guidance for power bi redmond sql sat 2019
Visual guidance for power bi redmond sql sat 2019Visual guidance for power bi redmond sql sat 2019
Visual guidance for power bi redmond sql sat 2019
Berkovich Consulting
 
April2019newandexciting
April2019newandexcitingApril2019newandexciting
April2019newandexciting
Berkovich Consulting
 
SqlSat Victoria governance for PowerBI
SqlSat Victoria governance for PowerBISqlSat Victoria governance for PowerBI
SqlSat Victoria governance for PowerBI
Berkovich Consulting
 
March2019 Whats new and exciting with PowerBI?
March2019 Whats new and exciting with PowerBI?March2019 Whats new and exciting with PowerBI?
March2019 Whats new and exciting with PowerBI?
Berkovich Consulting
 
Power bi and azure ml
Power bi and azure mlPower bi and azure ml
Power bi and azure ml
Berkovich Consulting
 
February 2019 new and exciting
February 2019 new and excitingFebruary 2019 new and exciting
February 2019 new and exciting
Berkovich Consulting
 
Governance for power bi Toronto SPS Saturday
Governance for power bi Toronto SPS Saturday Governance for power bi Toronto SPS Saturday
Governance for power bi Toronto SPS Saturday
Berkovich Consulting
 
Redmond o365 & SharePoint Saturday governance for power bi
Redmond o365 & SharePoint Saturday governance for power biRedmond o365 & SharePoint Saturday governance for power bi
Redmond o365 & SharePoint Saturday governance for power bi
Berkovich Consulting
 
Power automate and power BI January 22 Baku
Power automate and power BI January 22 BakuPower automate and power BI January 22 Baku
Power automate and power BI January 22 Baku
Berkovich Consulting
 
Visual guidance for power bi toronto pbi tour (1)
Visual guidance for power bi toronto pbi tour (1)Visual guidance for power bi toronto pbi tour (1)
Visual guidance for power bi toronto pbi tour (1)
Berkovich Consulting
 
Visual guidance calgary user group
Visual guidance calgary user groupVisual guidance calgary user group
Visual guidance calgary user group
Berkovich Consulting
 
SQL Saturday Redmond The Power Platform
SQL Saturday Redmond The Power Platform SQL Saturday Redmond The Power Platform
SQL Saturday Redmond The Power Platform
Berkovich Consulting
 
Visual guidance for power bi redmond sql sat 2019
Visual guidance for power bi redmond sql sat 2019Visual guidance for power bi redmond sql sat 2019
Visual guidance for power bi redmond sql sat 2019
Berkovich Consulting
 
SqlSat Victoria governance for PowerBI
SqlSat Victoria governance for PowerBISqlSat Victoria governance for PowerBI
SqlSat Victoria governance for PowerBI
Berkovich Consulting
 
March2019 Whats new and exciting with PowerBI?
March2019 Whats new and exciting with PowerBI?March2019 Whats new and exciting with PowerBI?
March2019 Whats new and exciting with PowerBI?
Berkovich Consulting
 
Governance for power bi Toronto SPS Saturday
Governance for power bi Toronto SPS Saturday Governance for power bi Toronto SPS Saturday
Governance for power bi Toronto SPS Saturday
Berkovich Consulting
 
Redmond o365 & SharePoint Saturday governance for power bi
Redmond o365 & SharePoint Saturday governance for power biRedmond o365 & SharePoint Saturday governance for power bi
Redmond o365 & SharePoint Saturday governance for power bi
Berkovich Consulting
 
Ad

Recently uploaded (20)

Defense Against LLM Scheming 2025_04_28.pptx
Defense Against LLM Scheming 2025_04_28.pptxDefense Against LLM Scheming 2025_04_28.pptx
Defense Against LLM Scheming 2025_04_28.pptx
Greg Makowski
 
Developing Security Orchestration, Automation, and Response Applications
Developing Security Orchestration, Automation, and Response ApplicationsDeveloping Security Orchestration, Automation, and Response Applications
Developing Security Orchestration, Automation, and Response Applications
VICTOR MAESTRE RAMIREZ
 
Geometry maths presentation for begginers
Geometry maths presentation for begginersGeometry maths presentation for begginers
Geometry maths presentation for begginers
zrjacob283
 
PRE-NATAL GRnnnmnnnnmmOWTH seminar[1].pptx
PRE-NATAL GRnnnmnnnnmmOWTH seminar[1].pptxPRE-NATAL GRnnnmnnnnmmOWTH seminar[1].pptx
PRE-NATAL GRnnnmnnnnmmOWTH seminar[1].pptx
JayeshTaneja4
 
Day 1 - Lab 1 Reconnaissance Scanning with NMAP, Vulnerability Assessment wit...
Day 1 - Lab 1 Reconnaissance Scanning with NMAP, Vulnerability Assessment wit...Day 1 - Lab 1 Reconnaissance Scanning with NMAP, Vulnerability Assessment wit...
Day 1 - Lab 1 Reconnaissance Scanning with NMAP, Vulnerability Assessment wit...
Abodahab
 
Ppt. Nikhil.pptxnshwuudgcudisisshvehsjks
Ppt. Nikhil.pptxnshwuudgcudisisshvehsjksPpt. Nikhil.pptxnshwuudgcudisisshvehsjks
Ppt. Nikhil.pptxnshwuudgcudisisshvehsjks
panchariyasahil
 
Conic Sectionfaggavahabaayhahahahahs.pptx
Conic Sectionfaggavahabaayhahahahahs.pptxConic Sectionfaggavahabaayhahahahahs.pptx
Conic Sectionfaggavahabaayhahahahahs.pptx
taiwanesechetan
 
CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...
CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...
CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...
ThanushsaranS
 
Thingyan is now a global treasure! See how people around the world are search...
Thingyan is now a global treasure! See how people around the world are search...Thingyan is now a global treasure! See how people around the world are search...
Thingyan is now a global treasure! See how people around the world are search...
Pixellion
 
Classification_in_Machinee_Learning.pptx
Classification_in_Machinee_Learning.pptxClassification_in_Machinee_Learning.pptx
Classification_in_Machinee_Learning.pptx
wencyjorda88
 
Simple_AI_Explanation_English somplr.pptx
Simple_AI_Explanation_English somplr.pptxSimple_AI_Explanation_English somplr.pptx
Simple_AI_Explanation_English somplr.pptx
ssuser2aa19f
 
History of Science and Technologyandits source.pptx
History of Science and Technologyandits source.pptxHistory of Science and Technologyandits source.pptx
History of Science and Technologyandits source.pptx
balongcastrojo
 
Flip flop presenation-Presented By Mubahir khan.pptx
Flip flop presenation-Presented By Mubahir khan.pptxFlip flop presenation-Presented By Mubahir khan.pptx
Flip flop presenation-Presented By Mubahir khan.pptx
mubashirkhan45461
 
shit yudh slideshare power likha point presen
shit yudh slideshare power likha point presenshit yudh slideshare power likha point presen
shit yudh slideshare power likha point presen
vishalgurjar11229
 
Calories_Prediction_using_Linear_Regression.pptx
Calories_Prediction_using_Linear_Regression.pptxCalories_Prediction_using_Linear_Regression.pptx
Calories_Prediction_using_Linear_Regression.pptx
TijiLMAHESHWARI
 
Data Science Courses in India iim skills
Data Science Courses in India iim skillsData Science Courses in India iim skills
Data Science Courses in India iim skills
dharnathakur29
 
Data Analytics Overview and its applications
Data Analytics Overview and its applicationsData Analytics Overview and its applications
Data Analytics Overview and its applications
JanmejayaMishra7
 
04302025_CCC TUG_DataVista: The Design Story
04302025_CCC TUG_DataVista: The Design Story04302025_CCC TUG_DataVista: The Design Story
04302025_CCC TUG_DataVista: The Design Story
ccctableauusergroup
 
Secure_File_Storage_Hybrid_Cryptography.pptx..
Secure_File_Storage_Hybrid_Cryptography.pptx..Secure_File_Storage_Hybrid_Cryptography.pptx..
Secure_File_Storage_Hybrid_Cryptography.pptx..
yuvarajreddy2002
 
Minions Want to eat presentacion muy linda
Minions Want to eat presentacion muy lindaMinions Want to eat presentacion muy linda
Minions Want to eat presentacion muy linda
CarlaAndradesSoler1
 
Defense Against LLM Scheming 2025_04_28.pptx
Defense Against LLM Scheming 2025_04_28.pptxDefense Against LLM Scheming 2025_04_28.pptx
Defense Against LLM Scheming 2025_04_28.pptx
Greg Makowski
 
Developing Security Orchestration, Automation, and Response Applications
Developing Security Orchestration, Automation, and Response ApplicationsDeveloping Security Orchestration, Automation, and Response Applications
Developing Security Orchestration, Automation, and Response Applications
VICTOR MAESTRE RAMIREZ
 
Geometry maths presentation for begginers
Geometry maths presentation for begginersGeometry maths presentation for begginers
Geometry maths presentation for begginers
zrjacob283
 
PRE-NATAL GRnnnmnnnnmmOWTH seminar[1].pptx
PRE-NATAL GRnnnmnnnnmmOWTH seminar[1].pptxPRE-NATAL GRnnnmnnnnmmOWTH seminar[1].pptx
PRE-NATAL GRnnnmnnnnmmOWTH seminar[1].pptx
JayeshTaneja4
 
Day 1 - Lab 1 Reconnaissance Scanning with NMAP, Vulnerability Assessment wit...
Day 1 - Lab 1 Reconnaissance Scanning with NMAP, Vulnerability Assessment wit...Day 1 - Lab 1 Reconnaissance Scanning with NMAP, Vulnerability Assessment wit...
Day 1 - Lab 1 Reconnaissance Scanning with NMAP, Vulnerability Assessment wit...
Abodahab
 
Ppt. Nikhil.pptxnshwuudgcudisisshvehsjks
Ppt. Nikhil.pptxnshwuudgcudisisshvehsjksPpt. Nikhil.pptxnshwuudgcudisisshvehsjks
Ppt. Nikhil.pptxnshwuudgcudisisshvehsjks
panchariyasahil
 
Conic Sectionfaggavahabaayhahahahahs.pptx
Conic Sectionfaggavahabaayhahahahahs.pptxConic Sectionfaggavahabaayhahahahahs.pptx
Conic Sectionfaggavahabaayhahahahahs.pptx
taiwanesechetan
 
CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...
CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...
CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...
ThanushsaranS
 
Thingyan is now a global treasure! See how people around the world are search...
Thingyan is now a global treasure! See how people around the world are search...Thingyan is now a global treasure! See how people around the world are search...
Thingyan is now a global treasure! See how people around the world are search...
Pixellion
 
Classification_in_Machinee_Learning.pptx
Classification_in_Machinee_Learning.pptxClassification_in_Machinee_Learning.pptx
Classification_in_Machinee_Learning.pptx
wencyjorda88
 
Simple_AI_Explanation_English somplr.pptx
Simple_AI_Explanation_English somplr.pptxSimple_AI_Explanation_English somplr.pptx
Simple_AI_Explanation_English somplr.pptx
ssuser2aa19f
 
History of Science and Technologyandits source.pptx
History of Science and Technologyandits source.pptxHistory of Science and Technologyandits source.pptx
History of Science and Technologyandits source.pptx
balongcastrojo
 
Flip flop presenation-Presented By Mubahir khan.pptx
Flip flop presenation-Presented By Mubahir khan.pptxFlip flop presenation-Presented By Mubahir khan.pptx
Flip flop presenation-Presented By Mubahir khan.pptx
mubashirkhan45461
 
shit yudh slideshare power likha point presen
shit yudh slideshare power likha point presenshit yudh slideshare power likha point presen
shit yudh slideshare power likha point presen
vishalgurjar11229
 
Calories_Prediction_using_Linear_Regression.pptx
Calories_Prediction_using_Linear_Regression.pptxCalories_Prediction_using_Linear_Regression.pptx
Calories_Prediction_using_Linear_Regression.pptx
TijiLMAHESHWARI
 
Data Science Courses in India iim skills
Data Science Courses in India iim skillsData Science Courses in India iim skills
Data Science Courses in India iim skills
dharnathakur29
 
Data Analytics Overview and its applications
Data Analytics Overview and its applicationsData Analytics Overview and its applications
Data Analytics Overview and its applications
JanmejayaMishra7
 
04302025_CCC TUG_DataVista: The Design Story
04302025_CCC TUG_DataVista: The Design Story04302025_CCC TUG_DataVista: The Design Story
04302025_CCC TUG_DataVista: The Design Story
ccctableauusergroup
 
Secure_File_Storage_Hybrid_Cryptography.pptx..
Secure_File_Storage_Hybrid_Cryptography.pptx..Secure_File_Storage_Hybrid_Cryptography.pptx..
Secure_File_Storage_Hybrid_Cryptography.pptx..
yuvarajreddy2002
 
Minions Want to eat presentacion muy linda
Minions Want to eat presentacion muy lindaMinions Want to eat presentacion muy linda
Minions Want to eat presentacion muy linda
CarlaAndradesSoler1
 

Dax & sql in power bi

  • 1. Yana Berkovich Data Platform MVP @yana_Berkovich YanaBerkovich.com Seattle CODECAMP DAX & SQL in PowerBI
  • 2. About Me BI Analyst& DEV, Microsoft Data Platform MVP Consultant, Product Manager BusinessIntelligenceand Data Visualization Consultant https://www.linkedin.com/in/yanaberkovich http://yanaberkovich.com @Yana_Berkovich
  • 3. AGENDA • What is PowerBI? • Where can we find the data? • SQL • DAX • DAX editor tool • Creating Slicers sample
  • 5. What is PowerBI? A suite of business analytics tools that deliver insights. Data processing and data visualization tool https://powerbi.microsoft.com Audience: Business Users & Managers Users: IT, Finance, HR, Marketing, Manufacturing, Data Analysts…
  • 6. WHAT ARE WE USING POWERBI FOR? Connect to Data sources Create Reports/ dashboards/ Applications Collaborate and Share Data Insights
  • 7. HOW DOES IT WORK? Who can Edit? How and who access Data Source Templates and custom visuals to use On Prem DB Who can consume Similar across devices Special authentication Design Data Integrity Scheduled connections
  • 8. WHAT IS CURRENTLY PART OF POWERBIPower BI desktop Power BI Desktop is the report authoring tool - https://powerbi.microsoft.com/en-us/desktop Access data from various data sources and transform them for your reporting needs Power BI Service – Pro/ Premium (Capacity, Licensing and Monitoring) Browser based portal - https://app.powerbi.com Share and collaborate with your collogues and wider audience PowerBI Report Server On premise solution for organizational reporting PowerBI Mobile Mobile Application, can be connected to your PowerBI on premise or the cloud PowerBI Data Gateway Install in your organization, to enable secure data connection (same as for PowerApps) Embedded Analytics PowerBI in Azure, set powerBI when needed, in the Azure portal Use PowerBI REST API & JS to embed in your applications PowerPlatform AI builder Melissa Coates – https://www.coatesda tastrategies.com @SQLChick, visualized it so much better! So let’s review
  • 10. THE MOST IMPORTANT THING…. Ask WHY??? Why are we doing this visualization? What is the business question
  • 11. ADVENTUREWORKS Sample Data Base and Data Warehouse by Microsoft Contains retail sales and customers data In reporting, we prefer the denormalized star schema data warehouse that has fact tables and dimension tables to create the reports quickly STAR Schema SNOWFLAKE Schema
  • 12. WHAT ARE WE GOING TO DO? ETL PowerBI style Extract •Connect to the DW •Get the Data Transform •SQL query •PowerBI editor •DAX query Load •Cache the data as part of model •Direct Query option
  • 13. CREATING YOUR DATA SOURCE Azure Portal (1st year trial period, students plans… ) NEW -> Data Warehouse Data warehouse – first create service or use an existing one (Details were in todays session: Building a better data solution: Microsoft SQL Server and Azure Data Services Joseph Dantoni) Sample DB Adventure Works Creating the server if needed
  • 14. PLAY AND PAUSE I can resume or stop the server It cost me a Starbucks Latte to get this demo running  pause your data warehouse when you are not using it
  • 15. SECURITY…. Don’t forget to add your IP or configure security settings to be able to connect to your Server Sample unable to connect error in PowerBI
  • 16. GETTING THE DATA • Desktop: Online:
  • 17. DATA CONNECTIONS • There are 230+ various built in data connections for the PowerPlatform • We are working with Azure SQL DW today named:AdventureWorks
  • 18. CONNECTING • Adding the servers name will connect to the server: YanaAdventure • Authentication: – Next screen logging in – In the SQL statement box as a full connection string • Data Transformation – Inside the PowerBI editor – In the SQL statement box (Select, from, where/join/sort/top…) Select * from DimOrganization Where CurrencyKey = 1 DW: Adventure
  • 19. THE DATA SOURCE SETTINGS WHERE TO CONNECT The data source settings and permissions for accessing a single or multiple data sources can be configured using this screen
  • 20. SQL & TSQL • TSQL statements are used to perform the transactions to the databases. TSQL is mainly used to build the application logic. • SQL is a programming language which focuses on managing relational databases. T- SQL is a procedural extension used by SQL Server (www.complexsql.com ) • In Power BI – We can write SQL queries – When we get and transform the data we can do it manually or write a SQL query – It is actually TSQL… since we are building the application logic
  • 21. ON PREMISE – DATA GATEWAY We are using Azure SQL DW in the cloud, but what if our SQL DW / DW was on premise?
  • 22. DATA SOURCES – HOW TO CONNECT? • Install data gateway – Why do we need data Gateway? – Personal data Gateway – not for organizations, will not work for other users – Organizational/on premise– set with organizational user – password expiry and security – Configure the gateway in the report refresh, to avoid entering credentials • Create Application user – Enable organizational access, set the user to access the data source (SQL) • Data Refresh – Online - Defined on the Data Set not the individual report or dashboard – Report Server on premise – Access and permissions are defined on the folder level – Gateway has to be online and reachable – is your machine on? • Direct Query Access – Online Synchronization – Same user that is creating the PowerBI report has to publish it (Application or Admin) – A report can have multiple data sources, – A report cannot be Direct Query and multiple data source – Direct Query report has to have only 1 data base/source to access!
  • 23. THE POWER OF EXCEL - POWERQUERY • Power Query - cleansing and shaping the data – shape your data before load • Power Pivot - modelling and reporting Power Query also provides a Custom Connectors SDK so that third parties can create their own data connectors PowerBI is built on top of those 2 queries 2 great resources for PowerQuery and excel Training: https://exceleratorbi.com.au/shaping-modelling-power-bi/ ExcelGuru in Vancouver
  • 24. THE ERD • Fact tables – Sales & Resales transactions • Dimension tables: – Customers – Geographic location – Date – Product – Product Category • Cardinality – 1 to 1 – 1 to M – M to 1 – M to M • Direction – 1st table filters 2nd – 2nd table filters 1st – Both
  • 25. SHOULDN’T WE JUST CREATE A VIEW IN SQL? • YES! – but it is not always possible – DBA might not be on your side • Not always the best option if it is for certain visualizations • Maybe you just want a fragment of the data • Performance will improve on the PowerBI side if you do, but there are additional resources back in SQL
  • 26. WHAT IS DAX? DAX is a formula language. Used to define custom calculations for Calculated Columns and for Measures (also known as calculated fields) Includes some of the Excel functions + Aggregations Helps get the most out of your data
  • 27. THE DAX EXPERTS • The Definitive Guide to DAX Marco Russo & Alberto Ferrari DAX tools – https://www.sqlbi.com/tools/
  • 28. HOW DO I EDIT & LEARN DAX? • Visual studio extension • PowerBI • DAX editor By Marco Russo Microsoft: • https://docs.microsoft.com/en-us/dax/dax-function-reference Marco Russo https://www.sqlbi.com/author/marco-russo/ In tools you can find everything you need to develop DAX queries, download and use for debugging
  • 29. DAX STUDIO FOR POWERBI Download the DAX studio to analyze and check your DAX queries in PowerBI designer From www.SQLBI.com website built by Marco Russo & Alberto Ferrari, free for download
  • 30. R U N N I N G A D A X Q U E R Y T O C R E AT E T H E R E F E R E N C E S L I C E R T A B L E
  • 31. WHAT CAN WE DO? • Select and calculate the number of distinct rows – The Business Question: How many different currencies the company is currently supporting? Answer: Diffrent Currency = COUNTROWS(DISTINCT(FactResellerSales[CurrencyKey])) = COUNTROWS(DISTINCT(FactResellerSales[ResellerKey])) OR built in PowerBI visual that does the same
  • 32. CREATING A COMPLEX DAX QUERY FOR SLICER TABLE • What happens if we want to slice by more than one dimension? • Option 1 3 different filters in PowerBI • Option 2 DAX query to create a slicer table • Option 3 Manually creating a table • Option 4 Creating a SQL table/view
  • 34. MORE DEV OPTIONS • M – for most of the queries that contain a TSQL statement inside the query • Json – creating the custom themes for your report – Building custom visuals, the visual part • Python – Using the custom editor to create data analytics with Python scripting – Working with Azure ML studio – Creating Python visuals • R – Using the custom editor to create data analytics with R scripting – Creating R visuals – Working with Azure ML studio
  • 35. SUMMARYE • Connecting to the DW • Authentication • Sample view T • Query Editor • SQL query • DAX Query • DAX editor L • Load • Exploring the data • visualizations *,* slicer • Column vs calculation • Connection tables IMPORTANT LINKS FOR THE FUTURE: DAX reference Microsoft: Marco Russo & the tools Guy in a cube & Patrick – for everything that is new and exciting PowerBI.com PowerBI blog

Editor's Notes

  • #9: How to design reports in Power Bi Desktop How to publish to Power BI Service