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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Show orders that contain specific product

Hi all,

 

My table contains one row per order (i.e. I can have 3 rows, with 3 different products, but one order number)

 

I am trying to figure out a way to show orders that purchased this product (let's call it A) and any other one. For example, if I have 3 rows per order, one of which has product A, then all 3 rows would show (contains product A). If none of the rows has it, then (no product A).

 

OrderNumber Product    Result
1                       X              No A
1                       X              No A
2                       A              Has A
2                       X              Has A
2                       X              Has A
3                       X              Has A
3                       A              Has A

 

I tried smth with CALCULATE(COUNTROWS), FILTER, EARLIER but no desired result 😞 

 

Any help would be appreciated 🙂 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @Anonymous

 

 

Can you try this as well?

 

Ex_contain = Var inExist =CALCULATE(COUNT(Table1[OrderNo]),FILTER(Table1,Table1[OrderNo]=EARLIER(Table1[OrderNo]) && Table1[Product]="A"))
RETURN
IF(inExist>0,"Has A","No A")

 

Thanks
Raj

View solution in original post

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

Seems similar to a problem I solved in another thread. The function you want is CONTAINS. Bottom of this thread:

 

https://community.powerbi.com/t5/Desktop/Last-3-days-average-values-per-ID-using-date/m-p/459884#M21...

 



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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

HI @Anonymous

 

 

Can you try this as well?

 

Ex_contain = Var inExist =CALCULATE(COUNT(Table1[OrderNo]),FILTER(Table1,Table1[OrderNo]=EARLIER(Table1[OrderNo]) && Table1[Product]="A"))
RETURN
IF(inExist>0,"Has A","No A")

 

Thanks
Raj

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.