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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Prarabdha_07
Frequent Visitor

Power BI IF condition with Different table Columns

Hii,

I am connecting two Tables Customer (StoreID) and Store(BusinessEntityID) --

 

Prarabdha_07_3-1714938765906.png

 

 

I need to create a IF Measure using Columns from both the Tables like this --

Columns from Different Tables (IF) =
IF(SELECTEDVALUE(Store[Name]) = "A Bike Store" && SELECTEDVALUE(Customer[StoreID]) = 934,"Working","Not Working")

but while using this in a Table visual , values are duplicating and the attributes are not filtering as expected

Before --

 

Prarabdha_07_4-1714938802017.png

 

 

After Adding that Measure --

 

Prarabdha_07_5-1714938838806.png

 

 

How to resolve this?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Prarabdha_07 

 

After my testing, you can put the BusinessEntityID field in place of the StoreID field in the visualization if you wish.

vxuxinyimsft_0-1715318273519.png

 

Best Regards,
Yulia Xu

 

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

16 REPLIES 16
Syndicate_Admin
Administrator
Administrator

How do I extract data from another table that matches one or more columns?

Anonymous
Not applicable

Hi @Prarabdha_07 

 

You can import the table and then use Merge or Append queries in Power Query, the "Merge queries" is to merge the columns of the tables together, and the "Append queries" is to add the row data.

 

For more details, you can read related document link: 

Merge queries overview - Power Query | Microsoft Learn

Append queries - Power Query | Microsoft Learn

 

Best Regards,
Yulia Xu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Prarabdha_07
Frequent Visitor

Is this possible through a measure 

Prarabdha_07_0-1715195484510.png

 

Anonymous
Not applicable

Hi @Prarabdha_07 

 

Does the method I provide work for you? If you have any further questions, please feel free to ask me.

 

Best Regards,
Yulia Xu

Anonymous
Not applicable

Hi @Prarabdha_07 

 

After my testing, you can put the BusinessEntityID field in place of the StoreID field in the visualization if you wish.

vxuxinyimsft_0-1715318273519.png

 

Best Regards,
Yulia Xu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi @Prarabdha_07 

 

The following steps are for your reference:

 

sample:

vxuxinyimsft_5-1715132192005.png

 

vxuxinyimsft_6-1715132215420.png

 

Merge two tables in Power Query

vxuxinyimsft_0-1715131690784.png

 

vxuxinyimsft_1-1715131709886.png

Expand the table

vxuxinyimsft_2-1715131737144.png

 

Close & Apply

vxuxinyimsft_3-1715131918555.png

 

Create a measure as follows:

Measure = IF(MAX([Name]) = "A Bike Store" && MAX([Customer.StoreID]) = 934, "Working", "Not Working")

 

Final Output:

vxuxinyimsft_4-1715132090856.png

 

If there are still questions, please feel free to ask me.

 

Best Regards,
Yulia Xu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

We don't want to merge as data is huge

Will consider this as the last option 

rkottap
Frequent Visitor

Hi,
Try below.

Columns from Different Tables (IF) =
VAR SelectedStoreName = SELECTEDVALUE ( Store[Name] )
VAR SelectedStoreID = SELECTEDVALUE ( Customer[StoreID] )

RETURN
IF (SelectedStoreName = "A Bike Store" && SelectedStoreID = 934, "Working", "Not Working")

Same thing , values are duplicating

Johnjose
Frequent Visitor

hey, try to use switch function. Might you'll get correct answer.

Uzi2019
Super User
Super User

Hi @Prarabdha_07 

As per your measure if the condition is satisfied then working is displaying where condition is not satisfying showing Not working. 

 

Can you share the expected output by typing into excel like Input and output also?

or share the screenshot of your expected output. would be better for us to quickly solve your problem.

 

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

this is expected --

Prarabdha_07_0-1715001633490.png

Measure is actually duplicating the values

lbendlin
Super User
Super User

What do you like to resolve?  The outcome matches your request exactly.

No , Store id is duplicating 

Prarabdha_07_1-1715001747344.png

 

Do you want to suppress blank stores and "Not Working"  rows where a "Working"  row also exists?

I remove the blanks from both the tables

And I want this output

Prarabdha_07_0-1715143638614.png

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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