Whether its an online Power BI training or onsite Power BI training, DAX studio is a part of every Power BI DAX training. DAX studio has earned its way through the user-friendly interface that makes query building easier then every before. Here’s a blog series dedicated to this wonderful tool: DAX Studio Archives | Power BI Training Australia
In this exercise, you will learn how to categorize monthly sales for a product as low, medium, high and very high using SUMMARIZECOLUMNS() function.
This function provides more capabilities and was introduced by Microsoft as a replacement to SUMMARIZE().
To categorize the products:
- Open your Power BI desktop model.
- Right click on the Sales table in the Fields Pan.
- Click on New Column.
Column tools open.
- Type the following formula in the formula bar and press Enter
- Click on External Tools in the Ribbon.
- Click on DAX Studio.
- Erase the existing code in the Query Pan.
- In the Query Pan, type the following code.
- Click on Run in the File Tab.
The Results are generated in the Results Pan.
- Copy the Code from line 3-12 in DAX Studio.
- Open Power B Desktop.
- Click on the Modeling tab in the Ribbon.
- Click on New Table.
- Paste the code in the formula bar and press Enter
Notice that we are filtering the product table and not including Accessories category.
Now let’s create a calculated column in “High value Sales (CT)” to classify the sales.
- Right click on the High value Sales (CT) table in the Fields Pan.
- Click on New Column.
Column tools open.
- Type the following formula in the formula bar and press Enter.
- Click on Total Sales in High value Sales (CT) table in the Fields Pan.
Column Tools Open.
- Click on “$” and type “2” in the text box in formatting section.
- Click on the Model tab in the left ribbon.
- Drag the End of Month (CC) column from High Value Sales (CT) and drop to the Date in the Date table.
Please note that a many to one relationship between High Value Sales (CT) and Date table is created.
- Drag the ProductKey column from High Value Sales (CT) and drop to the ProductKey in the Product table.
Please note that a many to one relationship between High Value Sales (CT) and Date table is created.
- Click on Report View on the left Ribbon.
- Click on the matrix visual in the visualization pane.
- Drag and drop Category and Subcategory from the Product table to the rows.
- Drag and drop Total Sales from High Value Sales (CT) in Values
- Click on Slicer visual in the Visualization Pane.
- Drag and drop Sales Value Classification (CC) from High Value Sales (CT) to the Fields.
- Click on Slicer visual in the Visualization Pane.
- Drag and drop Year and Month Name from Date to the Fields.
- Click on the Arrow at the top and select List.
- In the Year, Month Name Slicer, Select 2017>Oct,Nov,Dec.
- In the Sales Value Classification (CC) slicer, Select 2) Medium.
Conclusion:
Categorizing low, medium and high value products is important for every business. It helps the company to analyze the trends, forecast sales and thereby, make smarter decision based on facts and figures. This blog post is dedicated to categorizing low, medium and high sales using the DAX studio with Power BI desktop.
Learning Power BI from Scratch? Get a complete, in-depth training on Microsoft Power BI by attending our training courses.