Forum Discussion

amitjangle's avatar
amitjangle
Regular Visitor
8 years ago
Solved

Sum/Count of distinct column values based on another column

Hello experts,

 

I am new in powerbi. Need help in below case.

 

I have order table like below.

Order Received DateOrder Received MonthOrder NumberOrder Delivered OnOrder Delivered MonthPayment Received OnPayment Received Month
01/06/2017Jun200026/06/2017Jun30/06/2017Jun
01/06/2017Jun200127/06/2017Jun30/06/2017Jun
01/06/2017Jun200207/07/2017Jul31/07/2017Jul
08/06/2017Jun2003    
09/06/2017Jun200410/07/2017Jul31/07/2017Jul
05/07/2017Jul200531/07/2017Jul31/08/2017Aug
05/07/2017Jul200601/08/2017Aug31/08/2017Aug
08/08/2017Aug2007    

I want to output like below in the calculated table to see order backlog.  Please help.

 

Row LabelsOrders ReceivedOrders DeliveredPayment Received
Jun522
Jul232
Aug112
Grand Total866
  • I would use the Query Editor to get your data into the following format:

     

    Order Number, Month, Type, Date

    2000, Jun, Order Received, 01/06/2017

    2000, Jun, Order Delivered, 26/06/2017

    2000, Jun, Payment Received, 30/06/2017

    ...

     

    You should be able to do this by either breaking this into multiple queries and appending or potentially unpivoting columns but for data in that format, I'm thinking multiple queries and appending together.

     

    At that point, your issue becomes fairly simple, you simply need a COUNT of each Type and a visual that includes Month and the measures you create for these, which would look something like:

     

    Orders Delivered = COUNT(Table[Order Number],FILTER(Table,[Type]="Order Delivered"))

1 Reply

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    I would use the Query Editor to get your data into the following format:

     

    Order Number, Month, Type, Date

    2000, Jun, Order Received, 01/06/2017

    2000, Jun, Order Delivered, 26/06/2017

    2000, Jun, Payment Received, 30/06/2017

    ...

     

    You should be able to do this by either breaking this into multiple queries and appending or potentially unpivoting columns but for data in that format, I'm thinking multiple queries and appending together.

     

    At that point, your issue becomes fairly simple, you simply need a COUNT of each Type and a visual that includes Month and the measures you create for these, which would look something like:

     

    Orders Delivered = COUNT(Table[Order Number],FILTER(Table,[Type]="Order Delivered"))