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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
webportal
Impactful Individual
Impactful Individual

How to create a table (or list) with the order codes of orders with both products

I have a "Transactions" table with the following structure:

 

ID | Product | OrderCode |  Value

1   |   8         | ABC             | 100

2   |   5         | ABC             | 150

3   |   4         | ABC            |  80

4   |   5         | XPT             | 100

5   |   6         | XPT             | 100

6   |   8         |  XPT             | 100

7   |   5         | XYZ              |  100

8   |   8         |  UYI              | 90

 

How do I create a table (or list) with the order codes of orders with both products 5 and 8?

 

In the example above it should be orders ABC and XPT.

 

Thank you!

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

I might look at this in more detail but at first glance it looks very similar to the problem that I wrote my "Patient Cohort" Quick Measure to solve.

 

https://community.powerbi.com/t5/Quick-Measures-Gallery/Patient-Cohort/m-p/391883

 

 



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...

View solution in original post

9 REPLIES 9
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @webportal,

 

You can new a calculated table:

New Table =
FILTER (
    Table,
    CALCULATE (
        DISTINCTCOUNT ( Table[Product] ),
        FILTER ( ALLEXCEPT ( Table, Table[OrderCode] ), Table[Product] = 5 )
    )
        + CALCULATE (
            DISTINCTCOUNT ( Table[Product] ),
            FILTER ( ALLEXCEPT ( Table, Table[OrderCode] ), Table[Product] = 8 )
        )
        >= 2
)

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Ashish_Mathur
Super User
Super User

Hi,

 

What is your expected result?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur
Similar to the solution presented above, although the visual should be a table instead of a comma separated string.
Greg_Deckler
Community Champion
Community Champion

I might look at this in more detail but at first glance it looks very similar to the problem that I wrote my "Patient Cohort" Quick Measure to solve.

 

https://community.powerbi.com/t5/Quick-Measures-Gallery/Patient-Cohort/m-p/391883

 

 



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...

@Greg_Deckler this works very well, thanks for sharing!

But how to return tmpTable3 as a table instead of a card with a comma separated string? If there are many patients in the cohort (orders in my case) the card won't do.

Thank you so much for helping!

Stachu
Community Champion
Community Champion

@webportal
if you use UNICHAR(10) (line break) instead of "," as separator it CONCATENATEX it should improve readability, still it's not a table per se. just a workaround



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

webportal
Impactful Individual
Impactful Individual

Good idea, thanks a lot!
🙂

I will look into that. I really, really, really wish that table and matrix visualizations accepted a measure that returned a table as a valid input. That would solve sooooooo many problems...



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...

Hi,
Yes, this is very similar to the problem I have in hands.
Your solution seems perfect, although I'll need a bit of thinking to fully understand it.
Thanks a lot for sharing this!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors