Forum Discussion
Conditional column selecting column from other table
- Anonymous7 years ago
Anonymous
Got it! So you can merge the tables with a LEFT JOIN. Then you can create a new conditional column with the format:
IF [new column] = null THEN output=Column1, ELSE [new column]
]
Hi Anonymous
I think now will be easier to understand.
| Table A | Table B | Output | |||
| Customer | Customer | Short Name | Short Name | ||
| Power BI AS | Power BI AS | Power BI | Power BI | ||
| Power BI Ltd | Power BI Ltd | Power BI | Power BI | ||
| Power BI Desktop AS | Power BI Desktop AS | Power BI | Power BI | ||
| Power BI Service AS | Power BI Service AS | Power BI | Power BI | ||
| Micro AS | Micro AS | Micro | Micro | ||
| Micro Soft Ltd | Micro Soft Ltd | Micro | Micro | ||
| Solutions AS | Solutions AS | ||||
| Mobile Ltd | Mobile Ltd | ||||
| Consulting Ltd | Consulting Ltd |
Anonymous
Got it! So you can merge the tables with a LEFT JOIN. Then you can create a new conditional column with the format:
IF [new column] = null THEN output=Column1, ELSE [new column]
]
- Anonymous7 years agoNot applicable
Anonymous
I think the only way to do that without merging queries would be to add a conditional column straightaway from Table A. This would automatically give customers by entity name a short name if it included something like "power bi" or "microsoft" and return the regular entity name if it has no short name.
- Anonymous7 years agoNot applicable
Thanks, Anonymous
Last doubt: is it possible to have the merged column (Table2.Column2) in Table A? I am wondering if I can avoid one more table.