Forum Discussion
Power BI IF condition with Different table Columns
Hii,
I am connecting two Tables Customer (StoreID) and Store(BusinessEntityID) --
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 --
After Adding that Measure --
How to resolve this?
- Anonymous2 years ago
Hi Prarabdha_07
After my testing, you can put the BusinessEntityID field in place of the StoreID field in the visualization if you wish.
Best Regards,
Yulia XuIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
16 Replies
- lbendlin
Super User
What do you like to resolve? The outcome matches your request exactly.
- Prarabdha_07Frequent Visitor
No , Store id is duplicating
- lbendlin
Super User
Do you want to suppress blank stores and "Not Working" rows where a "Working" row also exists?
- Uzi2019
Community Champion
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.
- Prarabdha_07Frequent Visitor
this is expected --
Measure is actually duplicating the values
- JohnjoseFrequent Visitor
hey, try to use switch function. Might you'll get correct answer.
- rkottapFrequent 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")- Prarabdha_07Frequent Visitor
Same thing , values are duplicating
- AnonymousNot applicable
Hi Prarabdha_07
The following steps are for your reference:
sample:
Merge two tables in Power Query
Expand the table
Close & Apply
Create a measure as follows:
Measure = IF(MAX([Name]) = "A Bike Store" && MAX([Customer.StoreID]) = 934, "Working", "Not Working")Final Output:
If there are still questions, please feel free to ask me.
Best Regards,
Yulia XuIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Prarabdha_07Frequent Visitor
We don't want to merge as data is huge
Will consider this as the last option
- Prarabdha_07Frequent Visitor
Is this possible through a measure
- AnonymousNot 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.
Best Regards,
Yulia XuIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot 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
- Syndicate_Admin
Administrator
How do I extract data from another table that matches one or more columns?
- AnonymousNot 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 XuIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.