cancel
Showing results for
Did you mean:
New Member

## Connecting tables with IF statements

Hello guys,

I am trying to connect multiple tables with IF statements and I couldnt do it. My base table is:

 Val1 Name 1 A 2 A 3 A 4 A 5 A 6 A 1 B 2 B 3 B 4 B 5 B 6 B 7 B 8 B 1 C 2 C 3 C 4 C 5 C

To this base table I want to add prices and IF Val1 is equal or between Val2 and Val3 add price from table below else add price from basic table.

 Val2 Val3 Name Price 2 4 A 300 3 6 B 400 2 3 C 500 5 6 A 600

Basic table:

 Name Price A 777 B 888 C 999

And result would look something like this:

Val1NamePrice

 1 A 777 2 A 300 3 A 300 4 A 300 5 A 600 6 A 600 1 B 888 2 B 888 3 B 400 4 B 400 5 B 400 6 B 400 7 B 888 8 B 888 1 C 999 2 C 500 3 C 500 4 C 999 5 C 999

Hope someone can help me. Thank you in advance.

1 ACCEPTED SOLUTION
Super User IV

@Matjaz , Create a new column

nueva columna ?
var _1 á maxx(filter(Table2, Table1[val] >- table2[Val2] && Table1[Val1] <-Table2[Val3] && Table1[name] à table2[name]), [price])
var _2 á maxx(filter(Table3, Table1[name] á table3[name]), [price])
devolución
if(blank(_1), _2, _1)

Proud to be a Super User!

Super User IV

@Matjaz , Create a new column

nueva columna ?
var _1 á maxx(filter(Table2, Table1[val] >- table2[Val2] && Table1[Val1] <-Table2[Val3] && Table1[name] à table2[name]), [price])
var _2 á maxx(filter(Table3, Table1[name] á table3[name]), [price])
devolución
if(blank(_1), _2, _1)

Proud to be a Super User!

Announcements

#### Happy New Year from Power BI

This is a must watch for a message from Power BI!