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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register 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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.