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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

If Statement to Compare Two Values From Different Tables

All, 

 

I am making a table in PBI and have all I need except for one missing piece. 

CollinSharp1_1-1638822456496.png

The highlighted event represents a problem that occurs occasionally. 

 

I have the Last Crew field which simply is this the last unitname frim the crew action table: 

CollinSharp1_3-1638822569636.png

 

If that field is blank though, I want to take the Who Completed field listed right beside it. 

 

Does anyone know a dax formula (I'm sure it is some sort of IF statement) to combine those two into one column? I am unsure how the Last option in field wells work, so any insight would be amazing.

 

Thanks! 

 

If I can provide any more insight, please let me know.

 

8 REPLIES 8
v-yetao1-msft
Community Support
Community Support

Hi @Anonymous 

Has your problem been solved ? If it has been solved, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regard

Community Support Team _ Ailsa Tao

Rudy_D
Resolver I
Resolver I

Hi Collin,

 

Are "Last Crew" and "Who completed" fields from the same table ?

 

You can simply create une new column with this formula :

 

New Column = IF(ISBLANK('Table'[Last crew]), 'Table'[Who completed], 'Table'[Last crew])
 
Regards,
 
Rudy
Anonymous
Not applicable

They are joined in the model view on event_idx if that provides any additional insight

Anonymous
Not applicable

They are in two separate tables. The last crew was unitname from the 'Crew Actions' table and Who Completed is from the 'Jobs' table. I am using the Last function on the dropdown to get the last crew, so I am not necessarily sure how to write that in DAX. That is where my confusion is coming from. 

CollinSharp1_0-1638891520215.png

 

Do you have a date field in the 'Jobs' table ?

 

If so, you could make both tables related using a calendar table.

Anonymous
Not applicable

CollinSharp1_0-1638892363638.png

This is how the statement should look but it is telling me they aren't related, but they are.

Anonymous
Not applicable

I renamed 'unitname' to 'last crew' so end users don't get confused.

Anonymous
Not applicable

Bump

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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