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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Countrows of data with only one row

Hi,

i have a dataset like this:

 

Order ID / Product ID

1 / P1

1 / P2

2 / P3

3 / P1

3 / P3

 

So if a customer has different products in his checkout, there will be a row for each product. So some orders have only one row, some more.

 

Now i want to analyze on every product id how many orders have only purchased this product.

And of course i need a measure of how many orders i have for every product combination (P1 and P2, P2 and P3, P1 and P3, all 3 Products).

 

I'm not so much into DAX, so thank you for your help.

 

Best,

Micha

 

 

    

 

2 REPLIES 2
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

You can create a calculated column “CombinePID”  to meet your requirement.

CombinePID = CALCULATE(CONCATENATEX('Table',[Product ID],"&"),ALLEXCEPT('Table','Table'[Order ID]))

To meet your first requirement you should create a calculated column first.

OnlyOne =
CALCULATE (
    COUNTROWS ( DISTINCT ( 'Table'[Order ID] ) ),
    FILTER ( 'Table', NOT ( CONTAINSSTRING ( 'Table'[CombinePID], "&" ) ) )
)

Then use "CombinePID" and "OnlyOne" to create a visual.2-3.PNG

To meet your first requirement you should create the following calculated column.

CombinePIDNum =
CALCULATE (
    COUNTROWS ( DISTINCT ( 'Table'[Order ID] ) ),
    FILTER ( 'Table', CONTAINSSTRING ( 'Table'[CombinePID], "&" ) )
)

Then use "CombinePID" and "CombinePIDNum" to create a visual.2-2.PNG

 

Best Regards,

Eads

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
Anonymous
Not applicable

Hi @v-eachen-msft ,

 

thank you, it's going in the right direction, but still not working for me.

So i created all the columns and created a table with "CombinePID" and "Only One" and "CombinePIDNum".

The result is that it's the same for alle product ID Combinations.

 

Also following problem: Let's say i have a transaction with one order_id and two product ids. The result in "combinePIDNum" is 2. But it should be 1, because it is one transaction.

 

Do you have an idea?

Thank you in advance.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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