Diese Präsentation wurde erfolgreich gemeldet.
Die SlideShare-Präsentation wird heruntergeladen. ×

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

Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Wird geladen in …3
×

Hier ansehen

1 von 32 Anzeige

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

Well designed model is core aspect for any successful BI project regardless the technology you are using.
Microsoft oriented BI solutions tend to use SSAS Tabular, Azure Analsysis Services and Power BI nowadays, and Microsoft provides its own tools to develop solutions for these products.

Designing model according to best practices and following standards is a must but sometimes could be an annoying and long process due to some lack in functionalities of the standard tools, because of this new "Community's Tools" born and they're used more and more.

Since 2020 Power BI is embracing "External Tools" to make developers' life easier, one of them is Tabular Editor.
During this session we'll se how to leverage "Advanced Scripting" feature in order to create model at the speed of light always following best practices and making BI development agile.

Well designed model is core aspect for any successful BI project regardless the technology you are using.
Microsoft oriented BI solutions tend to use SSAS Tabular, Azure Analsysis Services and Power BI nowadays, and Microsoft provides its own tools to develop solutions for these products.

Designing model according to best practices and following standards is a must but sometimes could be an annoying and long process due to some lack in functionalities of the standard tools, because of this new "Community's Tools" born and they're used more and more.

Since 2020 Power BI is embracing "External Tools" to make developers' life easier, one of them is Tabular Editor.
During this session we'll se how to leverage "Advanced Scripting" feature in order to create model at the speed of light always following best practices and making BI development agile.

Anzeige
Anzeige

Weitere Verwandte Inhalte

Ähnlich wie DataSaturday #1 - PBI Modeling At Warp Speed With Tabular Editor Advanced Scripting (20)

Aktuellste (20)

Anzeige

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

  1. 1. #datasatpn February 27th, 2021 Data Saturday #1 PBI modeling at warp speed with TE Advanced Scripting Riccardo Perico
  2. 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. 3. Agenda • What Tabular Editor is? • Why Tabular Editor? • Why scripting? • Modeling Best Practices • Let’s see it doing the job • Q&A
  4. 4. What Tabular Editor Is? PBI modeling at warp speed with TE Advanced Scripting Riccardo Perico - Lucient
  5. 5. https://tabulareditor.com
  6. 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…”
  7. 7. Again, what is it? • Offline editor for SSAS 2016+ / AAS / Power BI • It’s a JSON editor • No diagram view
  8. 8. TOM (Tabular Object Model) • Extensions AMO library • Support to programming scensarios • Tree representation model metadata
  9. 9. model.bim
  10. 10. Why Tabular Editor? (3 slides many reasons) PBI modeling at warp speed with TE Advanced Scripting Riccardo Perico
  11. 11. 1. It’s fast • JSON is loaded into RAM • Persisted when you save
  12. 12. 2. Cool features
  13. 13. 3. Featured in Power BI External Tools • Measures • Calculation groups • Perspectives • Translations • Other like Creating Tables possible but not supported yet
  14. 14. Advanced Scripting
  15. 15. Why scripting? PBI modeling at warp speed with TE Advanced Scripting Riccardo Perico - Lucient
  16. 16. Basically to… • Automation • Standardization • Increase productivity • Push reusability • Apply Best Practices
  17. 17. Modeling Best Practices PBI modeling at warp speed with TE Advanced Scripting Riccardo Perico - Lucient
  18. 18. Choose the right schema
  19. 19. Explicit it’s better
  20. 20. 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
  21. 21. Time Intelligence Sales Amount Sales Amount PY Sales YTD Sales PYTD Sales PMonth …
  22. 22. 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])))
  23. 23. Numeric measures for cards
  24. 24. Demo PBI modeling at warp speed with TE Advanced Scripting Riccardo Perico - Lucient
  25. 25. Use case: Star Schema in 2 Clicks PBI modeling at warp speed with TE Advanced Scripting Riccardo Perico - Lucient
  26. 26. Agile Star Schema • TE to make development faster • TE to make development more agile • TE to standardize development • TE to lower effort
  27. 27. 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; }
  28. 28. 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; } } } } }
  29. 29. 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
  30. 30. Q&A PBI modeling at warp speed with TE Advanced Scripting Riccardo Perico - Lucient
  31. 31. #datasatpn February 27th, 2021 Data Saturday #1 Thank You Riccardo Perico

Hinweis der Redaktion

  • Modern architecture
  • Designed to be a replacement of SSDT
  • Microsoft moved from XMLA to TOM
    You must be a seasoned modeler
  • 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


  • Beginning with the July 2020 release of Power BI Desktop
  • 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

  • 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); }

×