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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
cingram11
New Member

Matching Logic Report

I want to create a report that would show, for example, Item #s that are purchased by both Restaurant A and Restaurant B. How would I implement this? I currently have a table, in table view, with a column of the brand and a column of item #s. I just want to create a table in report view to show only matching item #s. 

For example, in the image below... I would want to show the matching item #s 200 and 300 in a visual report table.

cingram11_0-1750902322244.png

 

6 REPLIES 6
danextian
Super User
Super User

Please provide a workable sample data (not an image), your expected result from the same sample data and your reasoning behind. You may post a link to Excel or a sanitized copy of your PBIX stored in the cloud.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hello

I hope I have understood your question and if not, let me know.

In this case I am going to represent it in Restaurant (A, B, C) and the next column would be ArticleID. I attach a photo of how it could be represented in your report. I don't know if you can attach a GDP file. Luck

Ernesto_Santos_1-1750914071602.png

Hi @cingram11,
Thank you  for reaching out to the Microsoft fabric community forum.
you can achieve this by creating a calculated table that filters Item #s purchased by both Restaurant A and B.
If you use this DAX, you will get the result you expected.

CommonItems_AB = 
VAR TargetBrands = {"Restaurant A", "Restaurant B"}
RETURN
FILTER (
    VALUES (SalesData[Item #]),
    CALCULATE (
        DISTINCTCOUNT (SalesData[Brand] ),
        SalesData[Brand] IN TargetBrands
    ) = 2
)

I tested it with my sample data, and it worked fine. Please find the attached Pbix for your reference.
If this solution worked for you, kindly mark it as Accept as Solution and feel free to give a Kudos, it would be much appreciated.

Thank you,
Harshitha.

Is there a way to do this to just add a column in the same table and not have to create a new table?

Hi @cingram11,

Yes, you can do this without creating a new table. You just need to add a calculated column in your existing table that checks if the item is bought by both Restaurant A and B.
Dax you can use :

CommonItemFlag = 
VAR TargetBrands = {"Restaurant A", "Restaurant B"}
VAR BrandCount =
    CALCULATE (
        DISTINCTCOUNT(SalesData[Brand]),
        FILTER (
            SalesData,
            SalesData[Item #] = EARLIER(SalesData[Item #]) &&
            SalesData[Brand] IN TargetBrands
        )
    )
RETURN
IF(BrandCount = 2, 1, 0)

This approach will return a value of 1 for items that are shared between the two restaurants. You can then filter this column in your report to display only these common items.
I hope this information is helpful.

If the answer is helpful, please click "Accept Answer" and feel free to give a Kudos, so others can benefit as well.
Best Regards,
Harshitha.

ryan_mayu
Super User
Super User

@cingram11 

pls provide some sample data and expected output





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

Proud to be a Super User!




Helpful resources

Announcements
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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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