Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
amitjangle
Regular Visitor

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
1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

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"))


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

1 REPLY 1
Greg_Deckler
Super User
Super User

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"))


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.