Forum Discussion
gerard-kouadio
3 years agoHelper I
create new column from 2 tables using if function
Hello, I have 2 tables and I want to create a column from the ids of the 2 tables. I want to do something like this: if id of table 1 = id of table 2, put yes, if no, put No. NB: there is a many-to...
- 3 years ago
HI gerard-kouadio ,
Pls refer the below sample:
tableA:
Table B:
Column = var Q1 = TableA[ID] var NewCol = CALCULATE(MAX('Tableb'[ID]),Tableb[ID]=Q1) return IF(NewCol<>BLANK(),1,BLANK())Best Regards
Lucien
- 3 years agoI finally used this code:New colomn = if(ISBLANK(LOOKUPVALUE('Table1'[Id], 'Table1'[Id],Table2[Id])),"Non","Oui")
mariussve1
3 years agoSolution Sage
Hi,
I think you can achive this by using methods explained in this article:
https://www.sqlbi.com/articles/from-sql-to-dax-joining-tables/
Without knowing your data or model I think you should look at the selectcolumns and natural join, treatas and/or lookup.
And at the end combine this with IF or maybe switch.
Br
Marius