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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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

@ 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!:
Mastering Power BI 2nd Edition

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

@ 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!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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