SlideShare a Scribd company logo
1 of 40
Download to read offline
#sqlsat
Progetto Power BI – Un Decalogo
Lorenzo Vercellati
Sql saturday 829_decalogo_powerbi
Speaker
 Business Intelligence Specialist @ SolidQ
 Data Visualization Addicted
 Speaker al SQL Saturday
 DIAD Trainer
 PBIUG Milan Administrator
 @supergimi
 lorenzovercellati
Agenda
 Centralizzare la DataSource
 A ciascuno la sua dieta
 Lavoriamo solo su misure
 Calendar & Time Dimension from scratch
 Filters Applied
 A ciascuno il suo visual
 Custom Topojson
 Tips, Tricks & Tools
 Buone letture
Il Progetto PowerBI
Il Progetto BI
DataSource
ETL Flow
Visuals
Data Model
Il Progetto PowerBI
DataSource
ETL Flow
Visuals
Data Model
Centralizzare e Parametrizzare
la DataSource
Centralizzare la DataSource
Data
Source
Data
Set
Data
Set
Data
Source
Data
Source
Data
Set
Data
Set
A Ciascuno la sua dieta
Vertipaq Storage
Tab
XXX
XXX
YYY
ZZZ
AAA
AAA
AAA
Diz
XXX
YYY
ZZZ
AAA
Tab
XX.A
XX.B
YY.A
ZZ.A
ZZ.C
XX.C
YY.C
Diz
XX.A
XX.B
YY.A
ZZ.A
ZZ.C
XX.C
YY.C
Togliere ai Ricchi…
Tab
XX A
XX B
YY A
ZZ A
ZZ C
XX C
YY C
Diz
XX
YY
ZZ
XX
YY
Tab
XX
XX
YY
ZZ
ZZ
XX
YY
Tab
A
B
A
A
C
C
C
Diz
A
B
A
C
Tab
XX.A
XX.B
YY.A
ZZ.A
ZZ.C
XX.C
YY.C
…e dare ai Poveri
Se non abbiamo Longitudine e Latitudine dobbiamo affidarci ai
nomi dei luoghi geografici!
I casi di omonimia geografica sono tantissimi e i servizi di
geolocalizzazione di Bing non sempre rispondono a dovere.
Più informazioni gli diamo, più facile sarà il loro lavoro e più
precise saranno le risposte.
Categorizziamo sempre le colonne geografiche.
Lavoriamo solo su misura
Lavoriamo solo su Misura
Per il semplice fatto che Power BI ce le
propone come misure, non significa che
dobbiamo usare le colonne numeriche
come misure nei visual!
Lavoriamo solo su Misura
 Creo le misure Base a partire dalle colonne
numeriche
ColValue
TotaleValue
TotaleValue
PreviousYear
Saldo vs
PreviousYear
% vs
PreviousYear
 Creo le misure Complesse a partire dalle
misure Base
 Nascondo le colonne
Calendar and Time Dimension
from scratch
All You Need is Date Dim
All You Need is Date Dim
let
StartDate = #date(StartYear,12,1),
// EndDate = #date(EndYear,12,31),
EndDate = Date.From(DateTime.LocalNow()),
NumberOfDays = Duration.Days( EndDate - StartDate ),
Dates = List.Dates(StartDate, NumberOfDays+1, #duration(1,0,0,0)),
#"Converted to Table" = Table.FromList(Dates, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "FullDateAlternateKey"}}),
#"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",{{"FullDateAlternateKey", type date}}),
#"Inserted Year" = Table.AddColumn(#"Changed Type", "Year", each Date.Year([FullDateAlternateKey]), type number),
#"Inserted Month" = Table.AddColumn(#"Inserted Year", "Month Number", each Date.Month([FullDateAlternateKey]), type number),
#"Inserted Month Name" = Table.AddColumn(#"Inserted Month", "Month", each Date.MonthName([FullDateAlternateKey]), type text),
#"Inserted Quarter" = Table.AddColumn(#"Inserted Month Name", "Quarter Number", each Date.QuarterOfYear([FullDateAlternateKey]), type number),
#"Inserted Week of Year" = Table.AddColumn(#"Inserted Quarter", "Week of Year", each Date.WeekOfYear([FullDateAlternateKey]), type number),
#"Inserted Week of Month" = Table.AddColumn(#"Inserted Week of Year", "Week of Month", each Date.WeekOfMonth([FullDateAlternateKey]), type number),
#"Inserted Day" = Table.AddColumn(#"Inserted Week of Month", "Day", each Date.Day([FullDateAlternateKey]), type number),
#"Inserted Day of Week" = Table.AddColumn(#"Inserted Day", "Day of Week Number", each Date.DayOfWeek([FullDateAlternateKey],1), type number),
#"Inserted Day of Year" = Table.AddColumn(#"Inserted Day of Week", "Day of Year", each Date.DayOfYear([FullDateAlternateKey]), type number),
#"Inserted Day Name" = Table.AddColumn(#"Inserted Day of Year", "Day of Week", each Date.DayOfWeekName([FullDateAlternateKey]), type text),
#"Inserted Year Month" = Table.AddColumn(#"Inserted Day Name", "Year Month Number", each [Year] * 100 + [Month Number], type number),
#"Inserted Year Month Name" = Table.AddColumn(#"Inserted Year Month", "Year Month", each Text.Combine({[Month], " ", Text.From([Year], "en-US")}), type text),
#"Inserted Year Quarter" = Table.AddColumn(#"Inserted Year Month Name", "Year Quarter Number", each [Year] * 10 + [Quarter Number], type number),
#"Inserted Quarter Name" = Table.AddColumn(#"Inserted Year Quarter", "Quarter", each Text.Combine({"Q", Text.From([Quarter Number], "en-US")}), type text),
#"Inserted Year Quarter Name" = Table.AddColumn(#"Inserted Quarter Name", "Year Quarter", each Text.Combine({[Quarter], " ", Text.From([Year], "en-US")}), type text),
#"Inserted Year Week" = Table.AddColumn(#"Inserted Year Quarter Name", "Year Week Number", each [Year] * 100 + [Week of Year], type number),
#"Inserted Year Week Name" = Table.AddColumn(#"Inserted Year Week", "Year Week", each Text.Combine({"Week", " ", Text.From([Week of Year], "en-US"), " ", Text.From([Year], "en-US")}), type text),
#"Renamed Columns1" = Table.RenameColumns(#"Inserted Year Week Name",{{"FullDateAlternateKey", "Date"}})
in
#"Renamed Columns1"
All You Need is Date Dim
let
SecondCount = 86400,
Source = List.Times(#time(0, 0, 0),SecondCount, #duration(0,0,0,1)),
TableFromList = Table.FromList(Source, Splitter.SplitByNothing()),
ChangedType = Table.TransformColumnTypes(TableFromList,{{"Column1", type time}}),
RenamedColumns = Table.RenameColumns(ChangedType,{{"Column1", "Time"}}),
InsertHour = Table.AddColumn(RenamedColumns, "Hour", each Time.StartOfHour([Time])),
InsertMinute = Table.AddColumn(InsertHour, "Minute", each Time.Minute([Time])),
ChangedTypeHour = Table.TransformColumnTypes(InsertMinute,{{"Hour", type time}}),
InsertQuarterHour = Table.AddColumn(ChangedTypeHour, "Quarter Hour", each if [Minute]<15 then [Hour] else if [Minute] < 30 then Value.Add([Hour],#duration(0,0,15, 0)) else if [Minute] < 45 then
Value.Add([Hour],#duration(0,0,30, 0)) else Value.Add([Hour],#duration(0,0,45, 0))),
ChangedTypeQtrHr = Table.TransformColumnTypes(InsertQuarterHour,{{"Quarter Hour", type time}}),
ReorderedColumns = Table.ReorderColumns(ChangedTypeQtrHr,{"Time", "Hour", "Quarter Hour", "Minute"}),
InsertHourNumber = Table.AddColumn(ReorderedColumns, "Hour Number", each Time.Hour([Time])),
NextHour = Table.AddColumn(InsertHourNumber, "Next Hour", each Value.Add([Hour],#duration(0,1,0, 0))),
NextQuarterHour = Table.AddColumn(NextHour, "Next Quarter Hour", each Value.Add([Quarter Hour],#duration(0,0,15, 0))),
InsertPeriod = Table.AddColumn(NextQuarterHour, "Period of Day",
each if [Hour Number] >= 0 and [Hour Number] < 4 then "After Midnight" else
if [Hour Number] >= 4 and [Hour Number] < 8 then "Early Morning" else
if [Hour Number] >= 8 and [Hour Number] < 12 then "Late Morning" else
if [Hour Number] >= 12 and [Hour Number] < 16 then "Afternoon" else
if [Hour Number] >= 16 and [Hour Number] < 20 then "Evening" else "Late Night"),
InsertPeriodSort = Table.AddColumn(InsertPeriod, "PeriodSort", each
if [Hour Number] >= 0 and [Hour Number] < 4 then 0 else
if [Hour Number] >= 4 and [Hour Number] < 8 then 1 else
if [Hour Number] >= 8 and [Hour Number] < 12 then 2 else
if [Hour Number] >= 12 and [Hour Number] < 16 then 3 else
if [Hour Number] >= 16 and [Hour Number] < 20 then 4 else 5),
InsertTimeKey = Table.AddColumn(InsertPeriodSort, "TimeKey", each Time.ToText([Time], "HHmm"), type text)
in
InsertTimeKey
Applied Filters
Applied Filters: un po’ di Chiarezza
Applied Filters: una Nuova Frontiera
From: https://www.sqlbi.com/articles/displaying-filter-context-in-power-bi-tooltips/
A ciascuno il suo Visual
Cleveland and McGill
Anche l’occhio vuole la sua parte…
L’occhio umano non è fatto per misurare gli
angoli ma lunghezze e distanze.
(cit. Alberto Cario, L’Arte Funzionale)
Tools
DAX Studio
Vertipaq Analyzer
Power BI Helper
Tips
M Helper
= #shared
Power Query Alert
PowEr qUeRy è CaSe sENsItivE
PowerBi Dataflows
I dataflows sono dataset condivisi?
Per i dataflows serve Premium Storage?
Posso combinare query su dataflows senza
Premium Storage?
NO!
NO!
NO…
…Anzi SI!
Tricks
0
12
3
4
5
6
7
8
9
10
11
12
13
14 15
16
17
20
21
22
23
24
25
26
27
28
30
31
33
34
35
36
37
38
39
40
41
42
43
4
4
45
46
47
49
51
52
53
54
80
78
79
85
76
77
86
Customizzare Topojson
Se non hai una mappa da convertire in topojson
Se non hai alternative (QGIS),
puoi sempre editare manualmente il file topojson
che generata la mappa
Topojson è un sottotipo del geojson file type
La struttura di un Topojson consistse in:
Una lista di arcs (segmenti)
Una lista di oggetti (poligoni) definiti da una
sequenza ordinata e chiusa di segmenti
0
12
3
4
5
6
7
8
9
10
11
12
13
14 15
16
17
20
21
22
23
24
25
26
27
28
30
31
33
34
35
36
37
38
39
40
41
42
43
4
4
45
46
47
49
51
52
53
54
80
78
79
85
76
77
86
Customizzare Topojson
Ogni Arc è definito da un entry point e da una
sequenza di punti.
Ogni Arc ha una direzione definita
Gli oggetti definiti da un arc con direzione opporta
sono referenziati come –1 * (arc + 1)
76
-77
Bibliografia
Buone Letture
PowerQuery
Chriss Webb: https://blog.crossjoin.co.uk/
DAX
SQLBI: https://www.sqlbi.com/articles/
PowerBI
Reza Rad: http://radacad.com/blog
Guy in a Cube: https://www.youtube.com/channel/UCFp1vaKzpfvoGai0vE5VJ0w
Dataflows
BI Polar: https://ssbipolar.com/2018/10/23/dataflows-in-power-bi/
Grazie!

More Related Content

Similar to Sql saturday 829_decalogo_powerbi

What's New for Developers in SQL Server 2008?
What's New for Developers in SQL Server 2008?What's New for Developers in SQL Server 2008?
What's New for Developers in SQL Server 2008?ukdpe
 
SQL Server 2008 Overview
SQL Server 2008 OverviewSQL Server 2008 Overview
SQL Server 2008 OverviewEric Nelson
 
Chapter 16-spreadsheet1 questions and answer
Chapter 16-spreadsheet1  questions and answerChapter 16-spreadsheet1  questions and answer
Chapter 16-spreadsheet1 questions and answerRaajTech
 
Adopting F# at SBTech
Adopting F# at SBTechAdopting F# at SBTech
Adopting F# at SBTechAntya Dev
 
Business Intelligence Portfolio
Business Intelligence PortfolioBusiness Intelligence Portfolio
Business Intelligence PortfolioChris Seebacher
 
Connect() Mini 2016
Connect() Mini 2016Connect() Mini 2016
Connect() Mini 2016Jeff Chu
 
Who killed object oriented design?
Who killed object oriented design?Who killed object oriented design?
Who killed object oriented design?Amir Barylko
 
Introduction to MS Excel
Introduction to MS ExcelIntroduction to MS Excel
Introduction to MS ExcelTarek Dib
 
e computer notes - Creating and managing tables
e computer notes -  Creating and managing tablese computer notes -  Creating and managing tables
e computer notes - Creating and managing tablesecomputernotes
 
Les09 (using ddl statements to create and manage tables)
Les09 (using ddl statements to create and manage tables)Les09 (using ddl statements to create and manage tables)
Les09 (using ddl statements to create and manage tables)Achmad Solichin
 
Sql server 2016: System Databases, data types, DML, json, and built-in functions
Sql server 2016: System Databases, data types, DML, json, and built-in functionsSql server 2016: System Databases, data types, DML, json, and built-in functions
Sql server 2016: System Databases, data types, DML, json, and built-in functionsSeyed Ibrahim
 
MongoDB World 2018: Using Change Streams to Keep Up with Your Data
MongoDB World 2018: Using Change Streams to Keep Up with Your DataMongoDB World 2018: Using Change Streams to Keep Up with Your Data
MongoDB World 2018: Using Change Streams to Keep Up with Your DataMongoDB
 
A Rusty introduction to Apache Arrow and how it applies to a time series dat...
A Rusty introduction to Apache Arrow and how it applies to a  time series dat...A Rusty introduction to Apache Arrow and how it applies to a  time series dat...
A Rusty introduction to Apache Arrow and how it applies to a time series dat...Andrew Lamb
 
SessionSeven_WorkingWithDatesandTime
SessionSeven_WorkingWithDatesandTimeSessionSeven_WorkingWithDatesandTime
SessionSeven_WorkingWithDatesandTimeHellen Gakuruh
 

Similar to Sql saturday 829_decalogo_powerbi (20)

What's New for Developers in SQL Server 2008?
What's New for Developers in SQL Server 2008?What's New for Developers in SQL Server 2008?
What's New for Developers in SQL Server 2008?
 
SQL Server 2008 Overview
SQL Server 2008 OverviewSQL Server 2008 Overview
SQL Server 2008 Overview
 
Bw14
Bw14Bw14
Bw14
 
Chapter 16-spreadsheet1 questions and answer
Chapter 16-spreadsheet1  questions and answerChapter 16-spreadsheet1  questions and answer
Chapter 16-spreadsheet1 questions and answer
 
Adopting F# at SBTech
Adopting F# at SBTechAdopting F# at SBTech
Adopting F# at SBTech
 
Business Intelligence Portfolio
Business Intelligence PortfolioBusiness Intelligence Portfolio
Business Intelligence Portfolio
 
Connect() Mini 2016
Connect() Mini 2016Connect() Mini 2016
Connect() Mini 2016
 
Who killed object oriented design?
Who killed object oriented design?Who killed object oriented design?
Who killed object oriented design?
 
Less08 Schema
Less08 SchemaLess08 Schema
Less08 Schema
 
Introduction to MS Excel
Introduction to MS ExcelIntroduction to MS Excel
Introduction to MS Excel
 
Les09
Les09Les09
Les09
 
e computer notes - Creating and managing tables
e computer notes -  Creating and managing tablese computer notes -  Creating and managing tables
e computer notes - Creating and managing tables
 
Les09 (using ddl statements to create and manage tables)
Les09 (using ddl statements to create and manage tables)Les09 (using ddl statements to create and manage tables)
Les09 (using ddl statements to create and manage tables)
 
Office
OfficeOffice
Office
 
Les09
Les09Les09
Les09
 
Sql server 2016: System Databases, data types, DML, json, and built-in functions
Sql server 2016: System Databases, data types, DML, json, and built-in functionsSql server 2016: System Databases, data types, DML, json, and built-in functions
Sql server 2016: System Databases, data types, DML, json, and built-in functions
 
MongoDB World 2018: Using Change Streams to Keep Up with Your Data
MongoDB World 2018: Using Change Streams to Keep Up with Your DataMongoDB World 2018: Using Change Streams to Keep Up with Your Data
MongoDB World 2018: Using Change Streams to Keep Up with Your Data
 
A Rusty introduction to Apache Arrow and how it applies to a time series dat...
A Rusty introduction to Apache Arrow and how it applies to a  time series dat...A Rusty introduction to Apache Arrow and how it applies to a  time series dat...
A Rusty introduction to Apache Arrow and how it applies to a time series dat...
 
How to Use JSON in MySQL Wrong
How to Use JSON in MySQL WrongHow to Use JSON in MySQL Wrong
How to Use JSON in MySQL Wrong
 
SessionSeven_WorkingWithDatesandTime
SessionSeven_WorkingWithDatesandTimeSessionSeven_WorkingWithDatesandTime
SessionSeven_WorkingWithDatesandTime
 

More from Lorenzo Vercellati

SQL Start! 2021 - The hidden treasure inside power bi
SQL Start! 2021 - The hidden treasure inside power biSQL Start! 2021 - The hidden treasure inside power bi
SQL Start! 2021 - The hidden treasure inside power biLorenzo Vercellati
 
Power BI - Dynamic role level security
Power BI - Dynamic role level securityPower BI - Dynamic role level security
Power BI - Dynamic role level securityLorenzo Vercellati
 
Data saturday # 0001 - The hidden treasure inside Power BI
Data saturday # 0001 - The hidden treasure inside Power BIData saturday # 0001 - The hidden treasure inside Power BI
Data saturday # 0001 - The hidden treasure inside Power BILorenzo Vercellati
 

More from Lorenzo Vercellati (6)

SQL Start! 2021 - The hidden treasure inside power bi
SQL Start! 2021 - The hidden treasure inside power biSQL Start! 2021 - The hidden treasure inside power bi
SQL Start! 2021 - The hidden treasure inside power bi
 
Power BI - Choose your map
Power BI - Choose your mapPower BI - Choose your map
Power BI - Choose your map
 
Power BI - Dynamic role level security
Power BI - Dynamic role level securityPower BI - Dynamic role level security
Power BI - Dynamic role level security
 
Choose the right visual
Choose the right visualChoose the right visual
Choose the right visual
 
Data saturday # 0001 - The hidden treasure inside Power BI
Data saturday # 0001 - The hidden treasure inside Power BIData saturday # 0001 - The hidden treasure inside Power BI
Data saturday # 0001 - The hidden treasure inside Power BI
 
Team management
Team managementTeam management
Team management
 

Recently uploaded

MEASURES OF DISPERSION I BSc Botany .ppt
MEASURES OF DISPERSION I BSc Botany .pptMEASURES OF DISPERSION I BSc Botany .ppt
MEASURES OF DISPERSION I BSc Botany .pptaigil2
 
SFBA Splunk Usergroup meeting March 13, 2024
SFBA Splunk Usergroup meeting March 13, 2024SFBA Splunk Usergroup meeting March 13, 2024
SFBA Splunk Usergroup meeting March 13, 2024Becky Burwell
 
Mapping the pubmed data under different suptopics using NLP.pptx
Mapping the pubmed data under different suptopics using NLP.pptxMapping the pubmed data under different suptopics using NLP.pptx
Mapping the pubmed data under different suptopics using NLP.pptxVenkatasubramani13
 
TINJUAN PEMROSESAN TRANSAKSI DAN ERP.pptx
TINJUAN PEMROSESAN TRANSAKSI DAN ERP.pptxTINJUAN PEMROSESAN TRANSAKSI DAN ERP.pptx
TINJUAN PEMROSESAN TRANSAKSI DAN ERP.pptxDwiAyuSitiHartinah
 
Virtuosoft SmartSync Product Introduction
Virtuosoft SmartSync Product IntroductionVirtuosoft SmartSync Product Introduction
Virtuosoft SmartSync Product Introductionsanjaymuralee1
 
CI, CD -Tools to integrate without manual intervention
CI, CD -Tools to integrate without manual interventionCI, CD -Tools to integrate without manual intervention
CI, CD -Tools to integrate without manual interventionajayrajaganeshkayala
 
Cash Is Still King: ATM market research '2023
Cash Is Still King: ATM market research '2023Cash Is Still King: ATM market research '2023
Cash Is Still King: ATM market research '2023Vladislav Solodkiy
 
How is Real-Time Analytics Different from Traditional OLAP?
How is Real-Time Analytics Different from Traditional OLAP?How is Real-Time Analytics Different from Traditional OLAP?
How is Real-Time Analytics Different from Traditional OLAP?sonikadigital1
 
YourView Panel Book.pptx YourView Panel Book.
YourView Panel Book.pptx YourView Panel Book.YourView Panel Book.pptx YourView Panel Book.
YourView Panel Book.pptx YourView Panel Book.JasonViviers2
 
Elements of language learning - an analysis of how different elements of lang...
Elements of language learning - an analysis of how different elements of lang...Elements of language learning - an analysis of how different elements of lang...
Elements of language learning - an analysis of how different elements of lang...PrithaVashisht1
 
ChistaDATA Real-Time DATA Analytics Infrastructure
ChistaDATA Real-Time DATA Analytics InfrastructureChistaDATA Real-Time DATA Analytics Infrastructure
ChistaDATA Real-Time DATA Analytics Infrastructuresonikadigital1
 
The Universal GTM - how we design GTM and dataLayer
The Universal GTM - how we design GTM and dataLayerThe Universal GTM - how we design GTM and dataLayer
The Universal GTM - how we design GTM and dataLayerPavel Šabatka
 
Strategic CX: A Deep Dive into Voice of the Customer Insights for Clarity
Strategic CX: A Deep Dive into Voice of the Customer Insights for ClarityStrategic CX: A Deep Dive into Voice of the Customer Insights for Clarity
Strategic CX: A Deep Dive into Voice of the Customer Insights for ClarityAggregage
 
5 Ds to Define Data Archiving Best Practices
5 Ds to Define Data Archiving Best Practices5 Ds to Define Data Archiving Best Practices
5 Ds to Define Data Archiving Best PracticesDataArchiva
 
Persuasive E-commerce, Our Biased Brain @ Bikkeldag 2024
Persuasive E-commerce, Our Biased Brain @ Bikkeldag 2024Persuasive E-commerce, Our Biased Brain @ Bikkeldag 2024
Persuasive E-commerce, Our Biased Brain @ Bikkeldag 2024Guido X Jansen
 
AI for Sustainable Development Goals (SDGs)
AI for Sustainable Development Goals (SDGs)AI for Sustainable Development Goals (SDGs)
AI for Sustainable Development Goals (SDGs)Data & Analytics Magazin
 
Master's Thesis - Data Science - Presentation
Master's Thesis - Data Science - PresentationMaster's Thesis - Data Science - Presentation
Master's Thesis - Data Science - PresentationGiorgio Carbone
 

Recently uploaded (17)

MEASURES OF DISPERSION I BSc Botany .ppt
MEASURES OF DISPERSION I BSc Botany .pptMEASURES OF DISPERSION I BSc Botany .ppt
MEASURES OF DISPERSION I BSc Botany .ppt
 
SFBA Splunk Usergroup meeting March 13, 2024
SFBA Splunk Usergroup meeting March 13, 2024SFBA Splunk Usergroup meeting March 13, 2024
SFBA Splunk Usergroup meeting March 13, 2024
 
Mapping the pubmed data under different suptopics using NLP.pptx
Mapping the pubmed data under different suptopics using NLP.pptxMapping the pubmed data under different suptopics using NLP.pptx
Mapping the pubmed data under different suptopics using NLP.pptx
 
TINJUAN PEMROSESAN TRANSAKSI DAN ERP.pptx
TINJUAN PEMROSESAN TRANSAKSI DAN ERP.pptxTINJUAN PEMROSESAN TRANSAKSI DAN ERP.pptx
TINJUAN PEMROSESAN TRANSAKSI DAN ERP.pptx
 
Virtuosoft SmartSync Product Introduction
Virtuosoft SmartSync Product IntroductionVirtuosoft SmartSync Product Introduction
Virtuosoft SmartSync Product Introduction
 
CI, CD -Tools to integrate without manual intervention
CI, CD -Tools to integrate without manual interventionCI, CD -Tools to integrate without manual intervention
CI, CD -Tools to integrate without manual intervention
 
Cash Is Still King: ATM market research '2023
Cash Is Still King: ATM market research '2023Cash Is Still King: ATM market research '2023
Cash Is Still King: ATM market research '2023
 
How is Real-Time Analytics Different from Traditional OLAP?
How is Real-Time Analytics Different from Traditional OLAP?How is Real-Time Analytics Different from Traditional OLAP?
How is Real-Time Analytics Different from Traditional OLAP?
 
YourView Panel Book.pptx YourView Panel Book.
YourView Panel Book.pptx YourView Panel Book.YourView Panel Book.pptx YourView Panel Book.
YourView Panel Book.pptx YourView Panel Book.
 
Elements of language learning - an analysis of how different elements of lang...
Elements of language learning - an analysis of how different elements of lang...Elements of language learning - an analysis of how different elements of lang...
Elements of language learning - an analysis of how different elements of lang...
 
ChistaDATA Real-Time DATA Analytics Infrastructure
ChistaDATA Real-Time DATA Analytics InfrastructureChistaDATA Real-Time DATA Analytics Infrastructure
ChistaDATA Real-Time DATA Analytics Infrastructure
 
The Universal GTM - how we design GTM and dataLayer
The Universal GTM - how we design GTM and dataLayerThe Universal GTM - how we design GTM and dataLayer
The Universal GTM - how we design GTM and dataLayer
 
Strategic CX: A Deep Dive into Voice of the Customer Insights for Clarity
Strategic CX: A Deep Dive into Voice of the Customer Insights for ClarityStrategic CX: A Deep Dive into Voice of the Customer Insights for Clarity
Strategic CX: A Deep Dive into Voice of the Customer Insights for Clarity
 
5 Ds to Define Data Archiving Best Practices
5 Ds to Define Data Archiving Best Practices5 Ds to Define Data Archiving Best Practices
5 Ds to Define Data Archiving Best Practices
 
Persuasive E-commerce, Our Biased Brain @ Bikkeldag 2024
Persuasive E-commerce, Our Biased Brain @ Bikkeldag 2024Persuasive E-commerce, Our Biased Brain @ Bikkeldag 2024
Persuasive E-commerce, Our Biased Brain @ Bikkeldag 2024
 
AI for Sustainable Development Goals (SDGs)
AI for Sustainable Development Goals (SDGs)AI for Sustainable Development Goals (SDGs)
AI for Sustainable Development Goals (SDGs)
 
Master's Thesis - Data Science - Presentation
Master's Thesis - Data Science - PresentationMaster's Thesis - Data Science - Presentation
Master's Thesis - Data Science - Presentation
 

Sql saturday 829_decalogo_powerbi

  • 1. #sqlsat Progetto Power BI – Un Decalogo Lorenzo Vercellati
  • 3. Speaker  Business Intelligence Specialist @ SolidQ  Data Visualization Addicted  Speaker al SQL Saturday  DIAD Trainer  PBIUG Milan Administrator  @supergimi  lorenzovercellati
  • 4. Agenda  Centralizzare la DataSource  A ciascuno la sua dieta  Lavoriamo solo su misure  Calendar & Time Dimension from scratch  Filters Applied  A ciascuno il suo visual  Custom Topojson  Tips, Tricks & Tools  Buone letture
  • 6. Il Progetto BI DataSource ETL Flow Visuals Data Model
  • 7. Il Progetto PowerBI DataSource ETL Flow Visuals Data Model
  • 10. A Ciascuno la sua dieta
  • 12. Togliere ai Ricchi… Tab XX A XX B YY A ZZ A ZZ C XX C YY C Diz XX YY ZZ XX YY Tab XX XX YY ZZ ZZ XX YY Tab A B A A C C C Diz A B A C Tab XX.A XX.B YY.A ZZ.A ZZ.C XX.C YY.C
  • 13. …e dare ai Poveri Se non abbiamo Longitudine e Latitudine dobbiamo affidarci ai nomi dei luoghi geografici! I casi di omonimia geografica sono tantissimi e i servizi di geolocalizzazione di Bing non sempre rispondono a dovere. Più informazioni gli diamo, più facile sarà il loro lavoro e più precise saranno le risposte. Categorizziamo sempre le colonne geografiche.
  • 15. Lavoriamo solo su Misura Per il semplice fatto che Power BI ce le propone come misure, non significa che dobbiamo usare le colonne numeriche come misure nei visual!
  • 16. Lavoriamo solo su Misura  Creo le misure Base a partire dalle colonne numeriche ColValue TotaleValue TotaleValue PreviousYear Saldo vs PreviousYear % vs PreviousYear  Creo le misure Complesse a partire dalle misure Base  Nascondo le colonne
  • 17. Calendar and Time Dimension from scratch
  • 18. All You Need is Date Dim
  • 19. All You Need is Date Dim let StartDate = #date(StartYear,12,1), // EndDate = #date(EndYear,12,31), EndDate = Date.From(DateTime.LocalNow()), NumberOfDays = Duration.Days( EndDate - StartDate ), Dates = List.Dates(StartDate, NumberOfDays+1, #duration(1,0,0,0)), #"Converted to Table" = Table.FromList(Dates, Splitter.SplitByNothing(), null, null, ExtraValues.Error), #"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "FullDateAlternateKey"}}), #"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",{{"FullDateAlternateKey", type date}}), #"Inserted Year" = Table.AddColumn(#"Changed Type", "Year", each Date.Year([FullDateAlternateKey]), type number), #"Inserted Month" = Table.AddColumn(#"Inserted Year", "Month Number", each Date.Month([FullDateAlternateKey]), type number), #"Inserted Month Name" = Table.AddColumn(#"Inserted Month", "Month", each Date.MonthName([FullDateAlternateKey]), type text), #"Inserted Quarter" = Table.AddColumn(#"Inserted Month Name", "Quarter Number", each Date.QuarterOfYear([FullDateAlternateKey]), type number), #"Inserted Week of Year" = Table.AddColumn(#"Inserted Quarter", "Week of Year", each Date.WeekOfYear([FullDateAlternateKey]), type number), #"Inserted Week of Month" = Table.AddColumn(#"Inserted Week of Year", "Week of Month", each Date.WeekOfMonth([FullDateAlternateKey]), type number), #"Inserted Day" = Table.AddColumn(#"Inserted Week of Month", "Day", each Date.Day([FullDateAlternateKey]), type number), #"Inserted Day of Week" = Table.AddColumn(#"Inserted Day", "Day of Week Number", each Date.DayOfWeek([FullDateAlternateKey],1), type number), #"Inserted Day of Year" = Table.AddColumn(#"Inserted Day of Week", "Day of Year", each Date.DayOfYear([FullDateAlternateKey]), type number), #"Inserted Day Name" = Table.AddColumn(#"Inserted Day of Year", "Day of Week", each Date.DayOfWeekName([FullDateAlternateKey]), type text), #"Inserted Year Month" = Table.AddColumn(#"Inserted Day Name", "Year Month Number", each [Year] * 100 + [Month Number], type number), #"Inserted Year Month Name" = Table.AddColumn(#"Inserted Year Month", "Year Month", each Text.Combine({[Month], " ", Text.From([Year], "en-US")}), type text), #"Inserted Year Quarter" = Table.AddColumn(#"Inserted Year Month Name", "Year Quarter Number", each [Year] * 10 + [Quarter Number], type number), #"Inserted Quarter Name" = Table.AddColumn(#"Inserted Year Quarter", "Quarter", each Text.Combine({"Q", Text.From([Quarter Number], "en-US")}), type text), #"Inserted Year Quarter Name" = Table.AddColumn(#"Inserted Quarter Name", "Year Quarter", each Text.Combine({[Quarter], " ", Text.From([Year], "en-US")}), type text), #"Inserted Year Week" = Table.AddColumn(#"Inserted Year Quarter Name", "Year Week Number", each [Year] * 100 + [Week of Year], type number), #"Inserted Year Week Name" = Table.AddColumn(#"Inserted Year Week", "Year Week", each Text.Combine({"Week", " ", Text.From([Week of Year], "en-US"), " ", Text.From([Year], "en-US")}), type text), #"Renamed Columns1" = Table.RenameColumns(#"Inserted Year Week Name",{{"FullDateAlternateKey", "Date"}}) in #"Renamed Columns1"
  • 20. All You Need is Date Dim let SecondCount = 86400, Source = List.Times(#time(0, 0, 0),SecondCount, #duration(0,0,0,1)), TableFromList = Table.FromList(Source, Splitter.SplitByNothing()), ChangedType = Table.TransformColumnTypes(TableFromList,{{"Column1", type time}}), RenamedColumns = Table.RenameColumns(ChangedType,{{"Column1", "Time"}}), InsertHour = Table.AddColumn(RenamedColumns, "Hour", each Time.StartOfHour([Time])), InsertMinute = Table.AddColumn(InsertHour, "Minute", each Time.Minute([Time])), ChangedTypeHour = Table.TransformColumnTypes(InsertMinute,{{"Hour", type time}}), InsertQuarterHour = Table.AddColumn(ChangedTypeHour, "Quarter Hour", each if [Minute]<15 then [Hour] else if [Minute] < 30 then Value.Add([Hour],#duration(0,0,15, 0)) else if [Minute] < 45 then Value.Add([Hour],#duration(0,0,30, 0)) else Value.Add([Hour],#duration(0,0,45, 0))), ChangedTypeQtrHr = Table.TransformColumnTypes(InsertQuarterHour,{{"Quarter Hour", type time}}), ReorderedColumns = Table.ReorderColumns(ChangedTypeQtrHr,{"Time", "Hour", "Quarter Hour", "Minute"}), InsertHourNumber = Table.AddColumn(ReorderedColumns, "Hour Number", each Time.Hour([Time])), NextHour = Table.AddColumn(InsertHourNumber, "Next Hour", each Value.Add([Hour],#duration(0,1,0, 0))), NextQuarterHour = Table.AddColumn(NextHour, "Next Quarter Hour", each Value.Add([Quarter Hour],#duration(0,0,15, 0))), InsertPeriod = Table.AddColumn(NextQuarterHour, "Period of Day", each if [Hour Number] >= 0 and [Hour Number] < 4 then "After Midnight" else if [Hour Number] >= 4 and [Hour Number] < 8 then "Early Morning" else if [Hour Number] >= 8 and [Hour Number] < 12 then "Late Morning" else if [Hour Number] >= 12 and [Hour Number] < 16 then "Afternoon" else if [Hour Number] >= 16 and [Hour Number] < 20 then "Evening" else "Late Night"), InsertPeriodSort = Table.AddColumn(InsertPeriod, "PeriodSort", each if [Hour Number] >= 0 and [Hour Number] < 4 then 0 else if [Hour Number] >= 4 and [Hour Number] < 8 then 1 else if [Hour Number] >= 8 and [Hour Number] < 12 then 2 else if [Hour Number] >= 12 and [Hour Number] < 16 then 3 else if [Hour Number] >= 16 and [Hour Number] < 20 then 4 else 5), InsertTimeKey = Table.AddColumn(InsertPeriodSort, "TimeKey", each Time.ToText([Time], "HHmm"), type text) in InsertTimeKey
  • 22. Applied Filters: un po’ di Chiarezza
  • 23. Applied Filters: una Nuova Frontiera From: https://www.sqlbi.com/articles/displaying-filter-context-in-power-bi-tooltips/
  • 24. A ciascuno il suo Visual
  • 26. Anche l’occhio vuole la sua parte… L’occhio umano non è fatto per misurare gli angoli ma lunghezze e distanze. (cit. Alberto Cario, L’Arte Funzionale)
  • 27. Tools
  • 31. Tips
  • 33. Power Query Alert PowEr qUeRy è CaSe sENsItivE
  • 34. PowerBi Dataflows I dataflows sono dataset condivisi? Per i dataflows serve Premium Storage? Posso combinare query su dataflows senza Premium Storage? NO! NO! NO… …Anzi SI!
  • 36. 0 12 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 20 21 22 23 24 25 26 27 28 30 31 33 34 35 36 37 38 39 40 41 42 43 4 4 45 46 47 49 51 52 53 54 80 78 79 85 76 77 86 Customizzare Topojson Se non hai una mappa da convertire in topojson Se non hai alternative (QGIS), puoi sempre editare manualmente il file topojson che generata la mappa Topojson è un sottotipo del geojson file type La struttura di un Topojson consistse in: Una lista di arcs (segmenti) Una lista di oggetti (poligoni) definiti da una sequenza ordinata e chiusa di segmenti
  • 37. 0 12 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 20 21 22 23 24 25 26 27 28 30 31 33 34 35 36 37 38 39 40 41 42 43 4 4 45 46 47 49 51 52 53 54 80 78 79 85 76 77 86 Customizzare Topojson Ogni Arc è definito da un entry point e da una sequenza di punti. Ogni Arc ha una direzione definita Gli oggetti definiti da un arc con direzione opporta sono referenziati come –1 * (arc + 1) 76 -77
  • 39. Buone Letture PowerQuery Chriss Webb: https://blog.crossjoin.co.uk/ DAX SQLBI: https://www.sqlbi.com/articles/ PowerBI Reza Rad: http://radacad.com/blog Guy in a Cube: https://www.youtube.com/channel/UCFp1vaKzpfvoGai0vE5VJ0w Dataflows BI Polar: https://ssbipolar.com/2018/10/23/dataflows-in-power-bi/