When importing data into Power BI Desktop from various sources, it often retains predefined table and column names. To enhance usability and clarity, it's beneficial to modify these names for consistency and user-friendliness. Power Query Editor within Power BI Desktop offers a solution for making such alterations, streamlining data structures.
Building upon the previous data shaping scenario, further steps are necessary to simplify the sales data structure for the development of reports targeted at the Sales team. While column renaming has been addressed, the focus now shifts to evaluating the query (table) names for potential enhancements. Additionally, a thorough review of column contents is required, aiming to correct any inaccurate values.
Rename a query
Best practices involve renaming queries to more intuitive or user-friendly names. For instance, if a query like FactProductTable appears confusing, consider renaming it to something clearer, such as Products. Similarly, if a query has a prefix like vProduct, which might be unclear, removing the prefix is advisable.
In a specific scenario, examining the TargetSales query revealed an unhelpful name, especially since there's a query with the same name for each year. To enhance clarity, it's recommended to include the year in the query name. In Power Query Editor, navigate to the Queries pane, select the query to rename, right-click, choose Rename, modify the existing name or input a new one, and then press Enter.
Replace values
To replace specific values in a chosen column, leverage the Replace Values functionality within Power Query Editor.
In a practical instance, if you identify a misspelling like "December" in the Attribute column, take corrective action. Choose the relevant column (Attribute in this scenario), and access the Transform tab to opt for Replace Values.
In the Value to Find box, enter the name of the value that you want to replace, and then in the Replace With box, enter the correct value name and then select OK. In Power Query, you can't select one cell and change one value, like you might have done in Excel.
You can review the list of steps that you took to restructure and correct your data in the Query Settings pane. When you have completed all steps that you want to take, you can select Close & Apply to close Power Query Editor and apply your changes to your data model. However, you can take further action to clean and transform your data.
Replace null values
In some cases, your data sources may include null values, like a sales order's freight amount being null to indicate zero. If these null values persist, it can lead to inaccuracies in calculating averages. To address this, consider changing nulls to zero for more precise average calculations. Follow the same steps as before to replace null values with zero.
Remove duplicates
Utilize the Remove Duplicates feature in Power Query to eliminate duplicate entries in a chosen column, ensuring only unique names remain.
In this scenario, observe that the Category Name column has repetitive entries for each category. Consequently, you aim to generate a table featuring distinct categories for use in your semantic model. To execute this task, select the column, right-click on the column header, and opt for the Remove Duplicates function.
It is advisable to duplicate the table before eliminating duplicates. The Copy option, situated at the top of the context menu, allows you to create a copy of the table. This duplication enables a comparison between the original and modified tables, providing flexibility in utilizing both tables if necessary.
Best practice for nomenclature
There are no strict rules for naming conventions in tables, columns, and values, but it's advisable to adopt language and abbreviations widely accepted within your organization. Consensus on common terminology is crucial.
A recommended approach is to use descriptive business terms for tables, columns, and measures, replacing underscores with spaces. Consistency in abbreviations, prefixes, and terms like "number" and "ID" is essential. Overly brief abbreviations can lead to confusion if not commonly understood.
Simplify table names by avoiding excessive prefixes or suffixes, contributing to clarity and reducing confusion.
When substituting values, consider how they'll appear in reports. Lengthy values may pose readability challenges, while overly brief ones may hinder interpretation. If possible, avoid acronyms in values, ensuring the text fits appropriately within the visual.
SWETA SARANGI
22.02.2024