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

Cross Table If Statements?

Hi All, 

Only started with PowerBI last week so go easy on me!

 

I have tables like the below added:

 

Table A 
IDName
1A
2B
3C

 

Table B 
IDModel
1800
2HP 850
3Dell 900

 

Table C 
IDRAM
18GB
216GB
34GB

 

 

Table D 
IDHDD Type
1HDD
2SSD
3Unknown

 

There is a many to many relationship setup between A>BCD where BCD filter A.  Tables B,C + D contain many more ID's than Table A.

 

I need to create a new column in Table A (I think?) that I can do some if filtering on across BCD.  So for instance a couple variations would be:

IF ID= HDD=4GB Then "REPLACE"

IF ID= SSD=8GB Then "REUSE"

IF ID= SSD=8GB AND Model=800 Then "REPLACE"

etc

 

I cannot figure out how to do this!  When I add a new column into A I dont seem to be able to bring in columns from the other tables.

 

Any help would be greatly appreciated!

1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

  1. Try Merge Queries like in the video below.
  2. Or if you wont to preserve the model and add columns from different tables use RELATED or RELATEDTABLE DAX functions.

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

View solution in original post

4 REPLIES 4
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

  1. Try Merge Queries like in the video below.
  2. Or if you wont to preserve the model and add columns from different tables use RELATED or RELATEDTABLE DAX functions.

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

Anonymous
Not applicable

Thanks Mariusz,

 

Related hasnt worked due to the relationships, and I'll be damned if I can get RelatedTable to work in the way I'm after.

 

For instance, if the below is a normal query, how would I turn this into using the RelatedTable? - where v_GS_DISK[Caption0groups] is the RelatedTable.

 

Support = IF(FIND("HDD",v_GS_DISK[Caption0groups], 1,BLANK()),"Replace")

 

Started looking at Merging.  Its an option i'll continue to explore.  A couple questions however;

 

1) Does the data in the merge update when the sources brings in new information?

2) Is it posible to merge a group?  i.e in Table B I have a group i've made from a column.  But when I merge Table B to Table A, its not an option.  It took a reaaaly long time to make some of those groups and I reaaaly dont want to make them again manually in Table A post merge.

 

Thanks,

Rich

1) Yes, the merge is happening with each refresh and should normally be done in the beginning. 
Extract->Transform->Load
2) because the merge is done in the beginning, you cannot use grouping or other columns you created after.

Anonymous
Not applicable

Anyone any thoughts on the above?

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.