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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
johndolan2
Resolver I
Resolver I

If Contents of one cell is the same as another based on another column

Hi - Can you help ... I am trying to add a column that shows whether both components of a service ID are in the same or different states. ...  If they are in the same state I would like the result in the new column (Requested Result) to show "intra state" and if not then show "inter state".

 

*** There are 2 components to each Service ID. So in the example of service ID "123" since both of the A location and Z location components are in Florida my requested result would be Intra state.

 

I have a few thousand rows of these.

 

Thanks, John

 

Component          State       Service ID        Requested Result  
A Location     Florida   123   Intra state  
Z Location      Florida   123   Intra state  
A Location      New York        456   Inter state  
Z Location      Iowa   456   Inter state  
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@johndolan2 , Try a new column like

 

new column =
var _cnt = calculate(distinctCOUNT(Table[State]), filter(Table, [Service ID] = earlier([Service ID])))
return
if(_cnt >1, "Inter state", "Intra state")

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
johndolan2
Resolver I
Resolver I

Amit - You are unbelievable .... You just answered 2 of my questions in a matter of minutes!!!

 

Thank you so very, very much!

 

John

amitchandak
Super User
Super User

@johndolan2 , Try a new column like

 

new column =
var _cnt = calculate(distinctCOUNT(Table[State]), filter(Table, [Service ID] = earlier([Service ID])))
return
if(_cnt >1, "Inter state", "Intra state")

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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