- Fabric Terms
- Fabric Configuration
- Lakehouse
- Handle frequent schema change in Copy Activity
- Convert Lakehouse files from CSV to Delta format for Power BI Reporting
- SQL Analytics Endpoint
- Performance Optimisation - Lots of useless logs, lots of small files
- Query S3 data with SQL Endpoint
- Prevent new tables been added to Lakehouse automatically
- Query data from multiple tables in different Lakehouses without copying data
- Data Factory
- Power BI
- Query Folding
- Incremental Refresh
- XMLA Endpoint
- Power BI Mode
- Display all rows including duplicates in PowerBI visual
- Distinct Count vs Unique Count in PowerQuery
- Calculate Duplicated Rows in PowerQuery
- Power BI File Formats
- Reduce Query Execution time for visuals on all pages on top of large dataset
- Incremental Refresh fails in Power BI report
- Semantic Model
- PySpark
- Miscellaneous
Fabric Terms
Capacity
Lakehouse Managed Table
- A managed table is a physical table that stores data in a Lakehouse.
Lakehouse Shortcut
- Shortcuts in the Files section are typically used for referencing external files or data sources, not for querying data directly.
- Shortcuts in the
Tables sectionare used to reference structured data sources, making it easier to query and analyse data in a Lakehouse environment. - Shortcut will not copying the external data into the Lakehouse.
Lakehouse View
- Views in Lakehouse allow users to create
virtual tablesthat reference data from multiple tables across different Lakehouses.
Power BI DAX Formatter
- DAX Formatter in DAX Studio is a tool used for formatting DAX expressions in Power BI.
Power BI Model Explorer
Model Explorerallows users to navigate and manage the data model, including tables, columns, relationships, and measures.
Power BI Tabular Editor (Best Practice Analyser)
- The Best Practice Analyser in Tabular Editor is a too that helps
identify potential issuesandoptimisationsin a Power BI semantic model. - It can specifically highlight surrogate key columns with the
Summarise Byproperty set to a value other than None, making it easier to identify and optimise these columns.
Tabular Editor
- Tabular Editor allows users to programmatically change column properties, such as hiding columns, setting nullable, summarisation, availability in MDX, and marking columns as key columns.
Tenant
Subscription
Developer can deploy in Dev Test Workspace and view Prod Workspace
To setup a Dev, Test, and Prod workspaces, where Developers can only deploy to Dev and Test workspaces, and view Prod workspace.
You need
- Admin access to Deployment pipeline, to manage pipeline and deploy items.
- Contributor access to Dev, and Test workspaces.
- Viewer access to Prod workspace.
Fabric Configuration
Enable read-write access to dataset stored in Fabric via XMLA Endpoint
Capacity settingsdetermine the access level and permissions for datasets within the workspace.- Adjust the capacity settings to allow
read-write/read-onlyaccess via the XMLA Endpoint will enable the desired functionality for dataset stored in Fabric.
Create and Publish custom Direct Lake semantic model using External Tools
- From the
Tenant Settings, setAllow XMLA Endpoints and Analyse in Excelwith on-premises datasets to Enabled. - From the
Capacity Settings, setXMLA Endpoint to Read-Write. - From the
Tenant Settings, setUsers can create Fabric itemsto Enabled.
Lakehouse
Handle frequent schema change in Copy Activity
- From the
Destination Tab, setTable action to Overwrite.
Convert Lakehouse files from CSV to Delta format for Power BI Reporting
- Using the
Load to Tablefeature in Lakehouse explorer. - It allows you to convert the CSV files into the Delta Format with V-Order optimisation enabled.
SQL Analytics Endpoint
- Prevent new tables added to Lakehouse from being added automatically to default Semantic model of the lakehouse.
Performance Optimisation - Lots of useless logs, lots of small files
- Run the
VACUUMcommand on a schedule.VACUUMcommand will remove files that are not referenced by Delta Table in the past 30 days, while ensuring the transaction log remains consist and the ACID properties of the table are maintained.
- Run the
OPTIMIZEcommand on a schedule.OPTIMIZEcommand with Z-order or V-order parameter is used for optimising the physical layout of the data based on the values of a specific column.- It is not intended for removing unreferenced files and maintaining the ACID properties of the Delta table.
Query S3 data with SQL Endpoint
- Use the Delta format.
- Create a
shortcutin theTables section.- Shortcuts in the Tables section are used to reference structured data sources, making it easier to query and analyse data in a Lakehouse environment.
Prevent new tables been added to Lakehouse automatically
- Configure
SQL Analytics Endpointsettings allows you to control the behaviour of new tables being added to the default semantic model of the lakehouse. - By adjusting these settings, you can prevent new table from being automatically included in the semantic model.
Query data from multiple tables in different Lakehouses without copying data
Views in Lakehouseallow users to create virtual tables that reference data from multiple tables across different lakehouses.
Data Factory
Lookup Activity
- The
Lookupactivity is to execute the stored procedure in a warehouse, and retrieve the returned value for downstream activities in a pipeline.- It allows you to query a data store and retrieve a single row, which is suitable for executing the stored procedure and making its results available for further processing in the pipeline.
Pass values across multiple steps in Data Factory Pipeline
Lookup activitycan help you to execute the stored procedure in a warehouse, and retrieve the returned values for downstream activities in a pipeline.
Power BI
Query Folding
- A process where Power BI pushes the query back to the data source, to filter and transform the data before importing it.
- i.e. let the data source engine to process the data, before ingesting it into Power BI.
- This process can help optimise performance by reducing the amount of data brought into Power BI.
Incremental Refresh
- When configuring incremental refresh in Power BI, the
delta type of the column used to partition the datais critical for identifying the new data to refresh. - If the delta type of the column has changed, it can lead to issues in identifying and refreshing new data, potentially causing the refresh failure.
XMLA Endpoint
- XMLA Endpoint is a connectivity feature that enables direct access to the underlying Analytics services engine of Fabric data model.
- It allows external tools, like Power BI, SSMS, and Excel to connect directly to Fabric datasets using XMLA protocol for advanced data management, analysis, and reporting.
Power BI Mode
Import Mode.- Imports all data into Power BI’s in-memory storage, offering fast query performance.
- Ideal for small to medium-sized datasets where fast performance is crucial.
DirectQuery mode.- Queries data directly from the data source in real-time, without storing it in Power BI.
- Useful for large datasets that exceed Power BI’s in-memory storage limit.
- DirectQuery will be used by DAX queries when user interact with a report built from the Direct Lake semantic model.
- Direct Query allow queries can be sent directly to the data source.
Dual or Composite mode.- Dual mode combines both Import and DirectQuery mode.
Display all rows including duplicates in PowerBI visual
- Modify the
Summarise By propertyfor all columns will ensure that all rows are displayed in the visual. - By changing the summarisation method, duplicate rows will be included in the visual output, allowing all rows to appear.
- Other wrong options
- Add a unique field to each row. This will not guarantee that all rows are displayed in the visual. It may help in distinguishing between rows, but it does not address the issue of duplicate rows not being displayed.
Distinct Count vs Unique Count in PowerQuery
- Distinct Count.
- Distinct Count refers to
counting the number of different valuesin a column, regardless of their frequency. - for a list of [A, B, A, C, B, D], the distinct values are {A, B, C, D}, and the distinct count is 4.
- You use Distinct Count when you want the number of different entities, without caring how often each appears.
- Distinct Count refers to
- Unique Count.
- Unique Count, on the other hand, counts values that appears
only oncein the column. - for a list of [A, B, A, C, B, D], the unique values that appearing only once are {C, D}, so the unique count is 2.
- Unique Count is useful when you are interested in values that do no repeat in the data.
- Unique Count, on the other hand, counts values that appears
Calculate Duplicated Rows in PowerQuery
To calculate the number of duplicated rows, you can use
$$ \text{Duplicated Rows} = (\text{Total Rows} - \text{Distinct Count}) + (\text{Distinct Count} - \text{Unique Count}) $$
For example, with a list of [A, B, A, C, B, D]
- Total Rows = 6
- Distinct Count = 4, i.e. {A, B, C, D}
- Unique Count = 2, i.e. {C, D}
- Duplicated Rows = (6 - 4) + (4 - 2) = 4
- The first part calculates the number of rows that are not distinct, i.e. to get duplicated values {A, B}
- and the second part calculates the number of rows that are not unique, i.e. to get unique values {A, B}
- The sum is to get all the duplicated rows, which is {A, B, A, B} in this case.
Power BI File Formats
PBIX.- Power BI Desktop files that contains reports, data models, and visualisations.
PBIT.- Power BI Desktop template files, that contains a pre-defined set of data connections, queries, and data model settings.
PBIDS.- Power BI Data Source files, that contain information about data sources and their connection details.
PBIP.- PBIP is used for saving semantic models in Power BI Desktop when using the Tabular Model Definition Language (TMDL) extension.
- It allows for bulk changes to be made to the model.
Reduce Query Execution time for visuals on all pages on top of large dataset
- Use
user-defined aggregation.- User-defined aggregations allow you to pre-calculate and store aggregated values in the model, reducing the query execution time by avoiding the need to aggregate data at runtime.
- Use
automatic aggregation.- Automatic aggregation enables Power BI to automatically aggregate data at different levels of granularity, optimising query execution time by reducing the amount of data that needs to be processed for visuals in report.
- Other wrong options
- Query caching stores the results of previous queries in memory allowing faster retrieval of data when same query is executed again.
- While query caching can improve performance, it may not directly reduce query execution time for visuals on all pages for the reports.
Incremental Refresh fails in Power BI report
- The
delta type of the column used to partition has changed.- When configuring incremental refresh in Power BI, the delta type of the column used to partition the data is critical for identifying new data to refresh.
- If the delta type of the column has changed, it can lead to issues in identifying and refreshing new data, potentially causing the refresh failure.
Semantic Model
Enable Scale-out for a Semantic Model
- At the
Semantic Model level,setting the Large dataset storage format to On. - This setting allows the semantic model to take advantage of scale-out processing capabilities for improved performance scalability.
Analyse frequently used columns in memory
There are some DAX query load unnecessary columns into memory. To identify the frequently used columns that are loaded into memory, you can
- Use the
Vertipaq Analysertool.- The Vertipaq Analyser tool is specially designed to analyse and optimise data models create in Direct Lake mode.
- It provides detailed insights into the data model, including information on column usage and memory consumption.
- It makes it a suitable option for identifying frequently used columns loaded into memory.
- Query the
$System.DISCOVER_STORAGE_TABLE_COLUMN_SEGMENTSDynamic Management View (DMV)- Query this DMV provides information on the storage segments of columns within tables.
- By analysing this DMV, users can identify the frequently used columns that are loaded into memory.
Performance Optimisation
- Split
OrderDateTimefield into Date and Time columns.- as it can help to reduce the memory used by Model, and optimise storage of data and time values.
- Replace
TotalSalesAmountwith a measure can help reduce the memory used by Model.- as measures are calculated at query time, and do not require physical storage in the model.
Prevent implicit measures
- Use
Microsoft Power BI Desktop.- By using Power BI Desktop, you can enforce restrictions on the use of implicit measures and prevent report creators from populating visuals with them.
Tabular Editor.- With Tabular Editor, you can define restrictions and configurations within the model to prevent the use of implicit measures by report creators.
Identify Surrogate key column for SCD Type 2 table in Semantic Model
- Best Practice Analyser in Tabular Editor.
- It is a tool that helps identify potential issues and optimisations in a semantic model.
- It can specifically highlight surrogate key columns with the Summarise By property set to a value other than None.
Ensure user always use Direct Lake mode with semantic model
- From Model, configure the Direct Lake Behaviour option.
- It ensure that users’ queries always use Direct Lake mode.
- This option specifically controls the behaviour of the model to ensure that queries interact with the data in Direct Lake mode.
PySpark
Large dataset join a small dataset
- Use
broadcastfunction in PySpark allows the smaller DataFrame to be broadcasted to all nodes in the cluster, reducing data shuffling during the join operation. - This helps minimise the amount of data movement across the cluster and improves the performance of the join operation.
Note
crossJoinwill create a Cartesian product between two datasets, resulting in combination of every row from the first DataFrame with every row from the second DataFrame.
Necessary fields for Slow Change Dimension (SCD) Type2
- an effective
start dateand time - an effective
end dateand time - an
surrogate key
Filver vs KeepFilters
- When the FILTER function uses a nested CALCULATE function, replacing it with the
KEEPFILTERSfunction can reduce execution time.- This is because
KEEPFILTERSpreserves the existing filter context, while FILTER function can create additional filter contexts that may impact performance.
- This is because
Table Maintenance Operations
OPTIMISE.- Consolidates multiple small files into large file.
V-Order.- Applies optimised sorting, encoding, and compression to Delta parquet files to enable fast read operations across all the Fabric engines.
Vacuum.- Removes old files no longer referenced by a Delta table log.
- Files need to be older than retention threshold,and the default file retention threshold is
7days.
Miscellaneous
Get maximum value of a column with PowerQuery
Table.Profilefunction in PowerQuery is specifically designed to provide a profile of the data in a table, including summary statistics such as minimum, maximum, average, and count for numeric columns.- It’s the most appropriate choice for identifying the maximum value for the numeric columns in the dataset during the PowerQuery step.
Microsoft Fabric Capacity Metrics App
- is designed to provide detailed information on the capacity and performance metrics of the Fabric tenant.
- By using the app, you can identify whether throttling is occurring by monitoring the compute resources being utilised by the warehouse queries.
Dynamic Management View (DMV)
sys.dm_exec_requests- provide information about
each request that is executingwithin SQL Server. - By querying this DMV, you can identify teh
current status, wait time, and other relevant details of the report query that is taking longer than expected to complete
- provide information about
sys.dm_exec_sessions- contains information about the active sessions in SQL Server.
sys.dm_exec_connections- provides information about the current connections to SQL Server.
sys.dm_pdw_exec_requests- Specific to Azure Synapse Analytics, and provide information about the requests executing within the distributed query processing engine.