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
ravdha85
Frequent Visitor

Compare column values and output the result using DAX

Hi Experts,

I came across a scenario where I need to findout the restaurants that are serving the same items , if you consider the below dataset the item Pizza is server by restaurants ABC,DEF,XYZ. Kindly let me know if you need any more inputs, Thanks in advance for your expert assists.

 

RestaurantItems
ABCPizza
ABCBurger
ABCNoodles
XYZPizza
XYZFrenchfries
DEFPizza
DEFJuice
GHICoffe
GHITea

 

Expected o/p

 

RestaurantItemsFinal Result
ABCPizzaABC
ABCBurger 
ABCNoodles 
XYZPizzaXYZ
XYZFrenchfries 
DEFPizzaDEF
DEFJuice 
GHICoffe 
GHITea 
2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @ravdha85 ,

Please try below steps:

1. below is my test table

Table:

vbinbinyumsft_0-1679535439763.png

2. create a measure with below dax formula

Measure =
VAR tmp =
    SUMMARIZE ( ALL ( 'Table' ), 'Table'[Items], "Cnt", COUNTROWS ( 'Table' ) )
VAR tmp1 =
    CALCULATETABLE ( VALUES ( 'Table'[Items] ), FILTER ( tmp, [Cnt] >= 2 ) )
VAR _rst =
    SELECTEDVALUE ( 'Table'[Restaurant] )
VAR _item =
    SELECTEDVALUE ( 'Table'[Items] )
RETURN
    IF ( _item IN tmp1, _rst, BLANK () )

3. add a table visual with fields and measure

vbinbinyumsft_1-1679535462290.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Thanks @Anonymous  that worked🙂

View solution in original post

3 REPLIES 3
grazitti_sapna
Super User
Super User

Hi

You can create a calculated table with the help of the following formula. It will create a table where the restaurants are serving Pizza’s

Final Result = FILTER (All (Restaurant), Restaurant[Items]="Pizza")

Anonymous
Not applicable

Hi @ravdha85 ,

Please try below steps:

1. below is my test table

Table:

vbinbinyumsft_0-1679535439763.png

2. create a measure with below dax formula

Measure =
VAR tmp =
    SUMMARIZE ( ALL ( 'Table' ), 'Table'[Items], "Cnt", COUNTROWS ( 'Table' ) )
VAR tmp1 =
    CALCULATETABLE ( VALUES ( 'Table'[Items] ), FILTER ( tmp, [Cnt] >= 2 ) )
VAR _rst =
    SELECTEDVALUE ( 'Table'[Restaurant] )
VAR _item =
    SELECTEDVALUE ( 'Table'[Items] )
RETURN
    IF ( _item IN tmp1, _rst, BLANK () )

3. add a table visual with fields and measure

vbinbinyumsft_1-1679535462290.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks @Anonymous  that worked🙂

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.