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

count of single SKU orders

I'm trying to come up with a pivot (matrix) with [SKU] or rows that displays the number of Total Orders involving that SKU, and the number of single-SKU Orders.  My data consists of [Date][OrderID][SKU] and [Qty] fields.

My DAX formula of:

nSingle-SKU Orders := COUNTROWS(FILTER(SUMMARIZE(Table,Table[OrderID],"nLines",COUNTA([SKU]),"TotalQty",SUM([Qty])),[nLines]=1))

only returns the number of total orders involving the SKU on that row, instead of those where it is the ONLY SKU for the order.

 

The row filter of the SKU doesn't allow the formula to see/count all the rows of the orders.

Suggestions please.

1 ACCEPTED SOLUTION

Accepted Solutions
TrebligC Frequent Visitor
Frequent Visitor

Re: count of single SKU orders

That's it!!!  This is GREAT!  Exactly what I was looking for... and it's fast

 

Thanks so much for taking the time to help me out.

View solution in original post

5 REPLIES 5
BhaveshPatel Super Contributor
Super Contributor

Re: count of single SKU orders

As per my understanding, you are trying to calculate the total number of orders for a particular
SKU.
Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.
TrebligC Frequent Visitor
Frequent Visitor

Re: count of single SKU orders

No. My question is how do I count the number of orders that have only one SKU which is the SKU that is on the row of the pivot... single-SKU orders for each SKU.
BhaveshPatel Super Contributor
Super Contributor

Re: count of single SKU orders

screen1.PNGMEASURE AND REPORTscreen2.PNGMEASURE N TABULAR REPORT

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.
OwenAuger Super Contributor
Super Contributor

Re: count of single SKU orders

Hi @TrebligC,

 

This is the simplest measure I can think of (I've named the table Orders)

Number of Single-SKU Orders =
COUNTROWS (
    FILTER (
        VALUES ( Orders[OrderID] ),
        CALCULATE ( DISTINCTCOUNT ( Orders[SKU] ), ALL ( Orders[SKU] ) ) = 1
    )
)

Link to sample PBIX file

 

Output looks like:
Capture.PNG



Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!




TrebligC Frequent Visitor
Frequent Visitor

Re: count of single SKU orders

That's it!!!  This is GREAT!  Exactly what I was looking for... and it's fast

 

Thanks so much for taking the time to help me out.

View solution in original post

Helpful resources

Announcements
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)