cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
TrebligC
New Member

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

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
OwenAuger
Super User
Super User

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


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

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.

BhaveshPatel
Community Champion
Community Champion

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.

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.

MEASURE AND REPORTMEASURE AND REPORTMEASURE N TABULAR REPORTMEASURE 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.

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors