Se ha denunciado esta presentación.
Se está descargando tu SlideShare. ×
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Anuncio
Próximo SlideShare
August2019 release PowerBI
August2019 release PowerBI
Cargando en…3
×

Eche un vistazo a continuación

1 de 35 Anuncio

Más Contenido Relacionado

Presentaciones para usted (20)

Similares a Dax & sql in power bi (20)

Anuncio

Más de Berkovich Consulting (20)

Más reciente (20)

Anuncio

Dax & sql in power bi

  1. 1. Yana Berkovich Data Platform MVP @yana_Berkovich YanaBerkovich.com Seattle CODECAMP DAX & SQL in PowerBI
  2. 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. 3. AGENDA • What is PowerBI? • Where can we find the data? • SQL • DAX • DAX editor tool • Creating Slicers sample
  4. 4. POWER PLATFORM
  5. 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. 6. WHAT ARE WE USING POWERBI FOR? Connect to Data sources Create Reports/ dashboards/ Applications Collaborate and Share Data Insights
  7. 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. 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
  9. 9. THE MOST IMPORTANT THING…. Ask WHY??? Why are we doing this visualization? What is the business question
  10. 10. 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
  11. 11. 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
  12. 12. 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
  13. 13. 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
  14. 14. 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
  15. 15. GETTING THE DATA • Desktop: Online:
  16. 16. DATA CONNECTIONS • There are 230+ various built in data connections for the PowerPlatform • We are working with Azure SQL DW today named:AdventureWorks
  17. 17. 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
  18. 18. 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
  19. 19. 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
  20. 20. ON PREMISE – DATA GATEWAY We are using Azure SQL DW in the cloud, but what if our SQL DW / DW was on premise?
  21. 21. 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!
  22. 22. 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
  23. 23. 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
  24. 24. 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
  25. 25. 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
  26. 26. THE DAX EXPERTS • The Definitive Guide to DAX Marco Russo & Alberto Ferrari DAX tools – https://www.sqlbi.com/tools/
  27. 27. 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
  28. 28. 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
  29. 29. 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
  30. 30. 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
  31. 31. 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
  32. 32. 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
  33. 33. 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

Notas del editor

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

×