SlideShare a Scribd company logo
#datasatpn
February 27th, 2021
Data Saturday #1
PBI modeling at warp speed
with TE Advanced Scripting
Riccardo Perico
Riccardo Perico
rperico@lucient.com | @R1k91 |
medium.com/riccardo-perico | slideshare.net/riccardoperico
BI & Power BI Engineer @
+10 years in Microsoft “Data Realm”
Giving my little contribution to the community
Agenda
• What Tabular Editor is?
• Why Tabular Editor?
• Why scripting?
• Modeling Best Practices
• Let’s see it doing the job
• Q&A
What Tabular Editor Is?
PBI modeling at warp speed with TE Advanced Scripting
Riccardo Perico - Lucient
https://tabulareditor.com
The Genesis
Born in 2016 by Daniel Otykier
Principal Architect at Kapacity A/S (MVP)
“… I was asked by a client to reorganize
thousands of measures in a SSAS Tabular 2016
model… I started with SSDT…”
DataSaturday #1 - PBI Modeling At Warp Speed With Tabular Editor Advanced Scripting
Again, what is it?
• Offline editor for SSAS 2016+ / AAS / Power BI
• It’s a JSON editor
• No diagram view
TOM (Tabular Object Model)
• Extensions AMO library
• Support to programming scensarios
• Tree representation model metadata
model.bim
Why Tabular Editor?
(3 slides many reasons)
PBI modeling at warp speed with TE Advanced Scripting
Riccardo Perico
1. It’s fast
• JSON is loaded into RAM
• Persisted when you save
2. Cool features
3. Featured in Power BI External Tools
• Measures
• Calculation groups
• Perspectives
• Translations
• Other like Creating Tables
possible but not supported yet
Advanced Scripting
Why scripting?
PBI modeling at warp speed with TE Advanced Scripting
Riccardo Perico - Lucient
Basically to…
• Automation
• Standardization
• Increase productivity
• Push reusability
• Apply Best Practices
Modeling Best Practices
PBI modeling at warp speed with TE Advanced Scripting
Riccardo Perico - Lucient
Choose the right schema
Explicit it’s better
Hide confusing objects
Explicit Measure’s base column
Dimensions Keys
Lookup Columns
Working tables
Explicit Measure’s base column
Dimensions Keys
Lookup Columns
Working tables
Time Intelligence
Sales Amount
Sales Amount PY
Sales YTD
Sales PYTD
Sales PMonth
…
Format that DAX
EVALUATE
SUMMARIZECOLUMNS (
'Product'[Product],
Manufacturer[Manufacturer],
'Date'[Month],
"sales", Sales[sales],
"PY Sales",
CALCULATE (
Sales[Sales],
SAMEPERIODLASTYEAR ( 'Date'[Date] )
)
)
EVALUATE SUMMARIZECOLUMNS('Product'[Product],
Manufacturer[Manufacturer],'Date'[Month],"sales", Sales[sales], "PY
Sales", CALCULATE(Sales[Sales], SAMEPERIODLASTYEAR('Date'[Date])))
Numeric measures for cards
Demo
PBI modeling at warp speed with TE Advanced Scripting
Riccardo Perico - Lucient
Use case:
Star Schema in 2 Clicks
PBI modeling at warp speed with TE Advanced Scripting
Riccardo Perico - Lucient
Agile Star Schema
• TE to make development faster
• TE to make development more
agile
• TE to standardize development
• TE to lower effort
Measures Creation (+50)
var displayFolder = “<Area of Interest>";
var destinationTable = "Metriche";
var destTable = Model.Tables.FirstOrDefault(t => t.Name == destinationTable);
// Creates a SUM measure for every currently selected column and hide the column.
foreach(var c in Selected.Columns)
{
TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;
var name = textInfo.ToTitleCase(c.Name.Replace("_", " "));
var newMeasure = destTable.AddMeasure(
name, // Name
"SUM(" + c.DaxObjectFullName + ")", // DAX expression
displayFolder // Display Folder
);
// Set the format string on the new measure:
newMeasure.FormatString = "#,##0.00";
// Hide the base column:
c.IsHidden = true;
}
Relationships Creation (8Fact, 22Dim)
var keyPrefix = "id_dim_";
// Loop through all currently selected tables (assumed to be fact tables):
foreach(var fact in Selected.Tables)
{
// Loop through all SK columns on the current table:
foreach(var factColumn in fact.Columns.Where(c => c.Name.StartsWith(keyPrefix)))
{
// Find the dimension table corresponding to the current SK column:
var dim = Model.Tables.FirstOrDefault(t => factColumn.Name == (keyPrefix + t.Name.Replace(" ", "_").ToLower()));
if(dim != null)
{
// Find the key column on the dimension table:
var dimColumn = dim.Columns.FirstOrDefault(c => factColumn.Name == (c.Name.Replace(" ", "_").ToLower()));
if(dimColumn != null)
{
// Check whether a relationship already exists between the two columns:
if(!Model.Relationships.Any(r => r.FromColumn == factColumn && r.ToColumn == dimColumn))
{
// If relationships already exists between the two tables, new relationships will be created as inactive:
var makeInactive = Model.Relationships.Any(r => r.FromTable == fact && r.ToTable == dim);
// Add the new relationship:
var rel = Model.AddRelationship();
rel.FromColumn = factColumn;
rel.ToColumn = dimColumn;
factColumn.IsHidden = true;
if(makeInactive) rel.IsActive = false;
}
}
}
}
}
Useful Links
• Tabular Editor
• Tabular Object Model (TOM) in AMO
• Using external tools in Power BI (preview)
• Useful Script Snippets — Tabular Editor documentation
• Best practice rules to improve your model’s performance
• Chris Webb's BI Blog: IsAvailableInMDX Property
Q&A
PBI modeling at warp speed with TE Advanced Scripting
Riccardo Perico - Lucient
#datasatpn
February 27th, 2021
Data Saturday #1
Thank You
Riccardo Perico

More Related Content

PPTX
PBI WT DAX AnaBisbe.pptx
PDF
Advanced modeling in Power BI - Azure Meetup Duesseldorf.pdf
PPTX
Building your first Analysis Services Tabular BI Semantic model with SQL Serv...
PDF
Taming the shrew Power BI
PPTX
Power BI - 2016 - Public
PDF
Power BI / AAS Data Model Optimization 101 v2
PPTX
Big data models with Power BI - Composite Models and Aggregations
PDF
slides.pdf
PBI WT DAX AnaBisbe.pptx
Advanced modeling in Power BI - Azure Meetup Duesseldorf.pdf
Building your first Analysis Services Tabular BI Semantic model with SQL Serv...
Taming the shrew Power BI
Power BI - 2016 - Public
Power BI / AAS Data Model Optimization 101 v2
Big data models with Power BI - Composite Models and Aggregations
slides.pdf

Similar to DataSaturday #1 - PBI Modeling At Warp Speed With Tabular Editor Advanced Scripting (20)

PDF
Taming the shrew, Optimizing Power BI Options
PPTX
Power bi
PDF
Microsoft BI reporting capabilities (on-prem solutions) Presentation
PDF
knowledgeforumpowerbitrainingnew-230816140827-5eb14be7.pdf
PDF
PowerBI Training
PDF
power-bi-complete-guide-slides.pdf
PDF
Product transformation 2.0 analytics
PPTX
Dax formulas in power bi.pptx data analytics
PPTX
Intro to DAX Patterns
PDF
Power BI Interview Questions and Answers | Power BI Certification | Power BI ...
PDF
Top 10 of Data & BI Summit Series: Power BI Tips & Tricks from the Trenches
PDF
PUGML06 - Power BI Tips & Tricks from the Trenches
PPTX
Power BI Advanced Data Modeling Virtual Workshop
 
PDF
High Performance BI with Cognos and ParAccel Analytic Database
PPTX
DAX (Data Analysis eXpressions) from Zero to Hero
PPTX
Multidimensional or tabular points to consider
PPTX
Getting power bi
PPTX
Power BI data analysis power point file.
PDF
Power Bi Courses In Pune With Placements .pdf
PPTX
Understanding Power BI Data Model
Taming the shrew, Optimizing Power BI Options
Power bi
Microsoft BI reporting capabilities (on-prem solutions) Presentation
knowledgeforumpowerbitrainingnew-230816140827-5eb14be7.pdf
PowerBI Training
power-bi-complete-guide-slides.pdf
Product transformation 2.0 analytics
Dax formulas in power bi.pptx data analytics
Intro to DAX Patterns
Power BI Interview Questions and Answers | Power BI Certification | Power BI ...
Top 10 of Data & BI Summit Series: Power BI Tips & Tricks from the Trenches
PUGML06 - Power BI Tips & Tricks from the Trenches
Power BI Advanced Data Modeling Virtual Workshop
 
High Performance BI with Cognos and ParAccel Analytic Database
DAX (Data Analysis eXpressions) from Zero to Hero
Multidimensional or tabular points to consider
Getting power bi
Power BI data analysis power point file.
Power Bi Courses In Pune With Placements .pdf
Understanding Power BI Data Model
Ad

Recently uploaded (20)

PPTX
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
PDF
annual-report-2024-2025 original latest.
PPTX
Introduction to Basics of Ethical Hacking and Penetration Testing -Unit No. 1...
PPTX
Introduction to Knowledge Engineering Part 1
PPTX
Acceptance and paychological effects of mandatory extra coach I classes.pptx
PDF
BF and FI - Blockchain, fintech and Financial Innovation Lesson 2.pdf
PPTX
MODULE 8 - DISASTER risk PREPAREDNESS.pptx
PPTX
Supervised vs unsupervised machine learning algorithms
PPTX
Introduction-to-Cloud-ComputingFinal.pptx
PDF
Galatica Smart Energy Infrastructure Startup Pitch Deck
PPTX
climate analysis of Dhaka ,Banglades.pptx
PPTX
Computer network topology notes for revision
PPTX
IB Computer Science - Internal Assessment.pptx
PDF
Recruitment and Placement PPT.pdfbjfibjdfbjfobj
PPTX
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
PPTX
ALIMENTARY AND BILIARY CONDITIONS 3-1.pptx
PPTX
SAP 2 completion done . PRESENTATION.pptx
PDF
168300704-gasification-ppt.pdfhghhhsjsjhsuxush
PDF
Fluorescence-microscope_Botany_detailed content
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
annual-report-2024-2025 original latest.
Introduction to Basics of Ethical Hacking and Penetration Testing -Unit No. 1...
Introduction to Knowledge Engineering Part 1
Acceptance and paychological effects of mandatory extra coach I classes.pptx
BF and FI - Blockchain, fintech and Financial Innovation Lesson 2.pdf
MODULE 8 - DISASTER risk PREPAREDNESS.pptx
Supervised vs unsupervised machine learning algorithms
Introduction-to-Cloud-ComputingFinal.pptx
Galatica Smart Energy Infrastructure Startup Pitch Deck
climate analysis of Dhaka ,Banglades.pptx
Computer network topology notes for revision
IB Computer Science - Internal Assessment.pptx
Recruitment and Placement PPT.pdfbjfibjdfbjfobj
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
ALIMENTARY AND BILIARY CONDITIONS 3-1.pptx
SAP 2 completion done . PRESENTATION.pptx
168300704-gasification-ppt.pdfhghhhsjsjhsuxush
Fluorescence-microscope_Botany_detailed content
Ad

DataSaturday #1 - PBI Modeling At Warp Speed With Tabular Editor Advanced Scripting

  • 1. #datasatpn February 27th, 2021 Data Saturday #1 PBI modeling at warp speed with TE Advanced Scripting Riccardo Perico
  • 2. Riccardo Perico rperico@lucient.com | @R1k91 | medium.com/riccardo-perico | slideshare.net/riccardoperico BI & Power BI Engineer @ +10 years in Microsoft “Data Realm” Giving my little contribution to the community
  • 3. Agenda • What Tabular Editor is? • Why Tabular Editor? • Why scripting? • Modeling Best Practices • Let’s see it doing the job • Q&A
  • 4. What Tabular Editor Is? PBI modeling at warp speed with TE Advanced Scripting Riccardo Perico - Lucient
  • 6. The Genesis Born in 2016 by Daniel Otykier Principal Architect at Kapacity A/S (MVP) “… I was asked by a client to reorganize thousands of measures in a SSAS Tabular 2016 model… I started with SSDT…”
  • 8. Again, what is it? • Offline editor for SSAS 2016+ / AAS / Power BI • It’s a JSON editor • No diagram view
  • 9. TOM (Tabular Object Model) • Extensions AMO library • Support to programming scensarios • Tree representation model metadata
  • 11. Why Tabular Editor? (3 slides many reasons) PBI modeling at warp speed with TE Advanced Scripting Riccardo Perico
  • 12. 1. It’s fast • JSON is loaded into RAM • Persisted when you save
  • 14. 3. Featured in Power BI External Tools • Measures • Calculation groups • Perspectives • Translations • Other like Creating Tables possible but not supported yet
  • 16. Why scripting? PBI modeling at warp speed with TE Advanced Scripting Riccardo Perico - Lucient
  • 17. Basically to… • Automation • Standardization • Increase productivity • Push reusability • Apply Best Practices
  • 18. Modeling Best Practices PBI modeling at warp speed with TE Advanced Scripting Riccardo Perico - Lucient
  • 21. Hide confusing objects Explicit Measure’s base column Dimensions Keys Lookup Columns Working tables Explicit Measure’s base column Dimensions Keys Lookup Columns Working tables
  • 22. Time Intelligence Sales Amount Sales Amount PY Sales YTD Sales PYTD Sales PMonth …
  • 23. Format that DAX EVALUATE SUMMARIZECOLUMNS ( 'Product'[Product], Manufacturer[Manufacturer], 'Date'[Month], "sales", Sales[sales], "PY Sales", CALCULATE ( Sales[Sales], SAMEPERIODLASTYEAR ( 'Date'[Date] ) ) ) EVALUATE SUMMARIZECOLUMNS('Product'[Product], Manufacturer[Manufacturer],'Date'[Month],"sales", Sales[sales], "PY Sales", CALCULATE(Sales[Sales], SAMEPERIODLASTYEAR('Date'[Date])))
  • 25. Demo PBI modeling at warp speed with TE Advanced Scripting Riccardo Perico - Lucient
  • 26. Use case: Star Schema in 2 Clicks PBI modeling at warp speed with TE Advanced Scripting Riccardo Perico - Lucient
  • 27. Agile Star Schema • TE to make development faster • TE to make development more agile • TE to standardize development • TE to lower effort
  • 28. Measures Creation (+50) var displayFolder = “<Area of Interest>"; var destinationTable = "Metriche"; var destTable = Model.Tables.FirstOrDefault(t => t.Name == destinationTable); // Creates a SUM measure for every currently selected column and hide the column. foreach(var c in Selected.Columns) { TextInfo textInfo = new CultureInfo("en-US", false).TextInfo; var name = textInfo.ToTitleCase(c.Name.Replace("_", " ")); var newMeasure = destTable.AddMeasure( name, // Name "SUM(" + c.DaxObjectFullName + ")", // DAX expression displayFolder // Display Folder ); // Set the format string on the new measure: newMeasure.FormatString = "#,##0.00"; // Hide the base column: c.IsHidden = true; }
  • 29. Relationships Creation (8Fact, 22Dim) var keyPrefix = "id_dim_"; // Loop through all currently selected tables (assumed to be fact tables): foreach(var fact in Selected.Tables) { // Loop through all SK columns on the current table: foreach(var factColumn in fact.Columns.Where(c => c.Name.StartsWith(keyPrefix))) { // Find the dimension table corresponding to the current SK column: var dim = Model.Tables.FirstOrDefault(t => factColumn.Name == (keyPrefix + t.Name.Replace(" ", "_").ToLower())); if(dim != null) { // Find the key column on the dimension table: var dimColumn = dim.Columns.FirstOrDefault(c => factColumn.Name == (c.Name.Replace(" ", "_").ToLower())); if(dimColumn != null) { // Check whether a relationship already exists between the two columns: if(!Model.Relationships.Any(r => r.FromColumn == factColumn && r.ToColumn == dimColumn)) { // If relationships already exists between the two tables, new relationships will be created as inactive: var makeInactive = Model.Relationships.Any(r => r.FromTable == fact && r.ToTable == dim); // Add the new relationship: var rel = Model.AddRelationship(); rel.FromColumn = factColumn; rel.ToColumn = dimColumn; factColumn.IsHidden = true; if(makeInactive) rel.IsActive = false; } } } } }
  • 30. Useful Links • Tabular Editor • Tabular Object Model (TOM) in AMO • Using external tools in Power BI (preview) • Useful Script Snippets — Tabular Editor documentation • Best practice rules to improve your model’s performance • Chris Webb's BI Blog: IsAvailableInMDX Property
  • 31. Q&A PBI modeling at warp speed with TE Advanced Scripting Riccardo Perico - Lucient
  • 32. #datasatpn February 27th, 2021 Data Saturday #1 Thank You Riccardo Perico

Editor's Notes

  • #3: Modern architecture
  • #8: Designed to be a replacement of SSDT
  • #9: Microsoft moved from XMLA to TOM You must be a seasoned modeler
  • #14: Undo / Redo Multiselect Drag & Drop See partitions easily Hierarchies managed easily Multiple objects properties change (display folder) Show dependencies Copy and Paste (between models) Go to definition
  • #15: Beginning with the July 2020 release of Power BI Desktop
  • #21: Clearly define the summarization algorithm Clearly define formatting There’s no overlapping with other users Measure reusability Easier DAX Calculation Groups work just with explicit measure
  • #29: foreach (var m in Selected.Measures) { string measure_name = m.Name + " For Cards"; string measure_expr = "COALESCE([" + m.Name + "], 0)"; string display_fld = "For Cards"; Model.Tables["Fact Sale"].AddMeasure(measure_name, measure_expr, display_fld); }