You can use Group By on a table like below on the CustomerKey (this table has multiple records per each CustomerKey) Īnd the result then would be a table with one CustomerKey per row īesides the Group by field, you can also have aggregated results from the other parts of the table, which can be determined in the Group By Configuration window Group By is a transformation which groups the result based on one or more fields, and provide an aggregated result from the existing table.Ĭonsider the table below, which is the FactInternetSales table. this table has multiple records per each CustomerKey To learn more about when to choose M (Power Query), or when to choose DAX for a calculation, read my article here. If the dynamic calculation is not part of the requirement, then Power Query can be a good consideration for the implementation. However, sometimes this calculation can be done as a pre-calculation, and only the aggregated result is what needed at the end, the details are not needed. Having a distinct count in Power BI using DAX is great.
Why Power Query Transformation?īefore we start, it is important to know why in some scenarios, you might consider using Power Query for a transformation such as Distinct Count. In this article, I’ll show you a method you can use to get the distinct count of a particular column through the Group By transformation in Power Query component of Power BI. If you are doing the distinct count in Power Query as part of a group by operation, however, the existing distinct count is for all columns in the table, not for a particular column. You can have a distinct count calculation in multiple places in Power BI, through DAX code, using the Visual’s aggregation on a field, or even in Power Query.