Power BI GROUPBY DAX function will group data by collecting the information from two different tables. It works almost similar to the summarized function in Power BI. But, GROUPBY does not allow us to do any implicit calculations using the CALCULATE function. Instead, it allows us to use the new DAX function “CURRENTGROUP()” inside the aggregation functions in the additional column it adds.
Below is the SYNTAX of the Power BI GROUPBY DAX function.
We know it is not easy to understand by reading the syntax explanations, but you will learn clearly in the example sections.
We need at least two tables to use the Power BI GROUPBY function. Below are the two tables we will use for this DAX function demonstration.
For example, in the “Buyers” table, we have the category for each buyer, so we will group the data using these two tables.
While grouping the data, we need to identify the columns we need in the new group table. In this case, we need “Category,” “Buyer,” “Sale Value,” and “Cost Value.”
Copy and paste the data directly to Power BI, or you can copy the data to an Excel file and then import it to Power BI as an Excel file reference. So, you can download the Excel workbook template from the link below, which is used for this example.
We have directly uploaded the data to Power BI.
Since we are grouping the data, we need to store it as a new table.
As you can see above, we can see the aggregated grouped table.
Note: We can only use the CURRENTGROUP() function inside the Power BI GROUPBY function. This function provides access to the sub-table representing the current group in the GROUPBY function.
Note: We have done so much formatting to this table. You can download the Power BI RANKX template from the link below and apply each formatting technique as applied.
Things to Remember
- The CURRENTGROUP function is only the new function we can use inside the GROUPBY function.The CURRENTGROUP function takes the reference of the grouping table.We cannot use the CALCULATE function in the Power BICALCULATE Function In The Power BIPower BI Calculate serves as a base function to apply other DAX functions in various scenarios. Assume you wish to apply a filter to get the average sales for a specific location; you may use the CALCULATE function to apply the filter and arrive at calculations.read more GROUPBY DAX function.
Recommended Articles
This article has been a guide to Power BI GROUPBY. Here, we discuss how to group the data by collecting the information from two different tables using Power BI GROUPBY DAX function. You can learn more from the following articles: –
- Create Power BI ParametersPower BI KPIReports in Power BI – ExamplesPower BI Waterfall ChartPower BI Themes