cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kudy
Frequent Visitor

How to Group By with several columns?

Hi,

 

I have a simple table with 3 columns as shown in the attached picture:

- I tried to use Group By (in Query Editor) and could get the results in the column F, but not G.

 

please help

image.png

1 ACCEPTED SOLUTION
Jos_Woolley
Solution Sage
Solution Sage

4 REPLIES 4
colacan
Resolver II
Resolver II

Probably.. Because DAX makes new table using other data table(s). (in this case, the first table)

However, if the first table is also made from some other raw data, you can skip the first table and make the 2nd table using the raw data. Of cuase, you need different DAX code for it.

Thanks

Jos_Woolley
Solution Sage
Solution Sage

Hi,

Jos_Woolley_0-1632569523182.png

Regards

colacan
Resolver II
Resolver II

For number of product, we should use COUNT function and for Number of Cancelled Product, you can use SUM function.

If expressed in DAX, the table can be made as below 

=========================
ADDCOLUMNS(
    SUMMARIZE( OrderTable, OrderTable[OrderNumber] ),
    "TotNumberOfProduct", CALCULATE( COUNT( OrderTable[OrderNumber] ) ),
    "NumberOfCancellation", CALCULATE( SUM( OrderTable[Cancel] ) )
)

Kudy
Frequent Visitor

Thank you for a fast answer!

 

I tried this solution and got a new table with the result i wanted - Awesome!

So, if i want to transform/make my existing table to look like the new table then i have to do it in the query editor (with M language), isnt it?

Creating an additional table is abit messy right now , since i have too many tables and I am starting to loose track of them :).

 

 

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors
Top Kudoed Authors