Forum Discussion
PXJ
3 years agoFrequent Visitor
IFs excel
Hi all, I am trying to achieve the below that I've created in excel in power bi: Brand1=IF(Products[Brand]="Nissan", Products[Brand]&" "&"("&Products[PC]&")",Products[Brand] IF(Products[Bran...
- 3 years ago
Hi PXJ ,
Here a solution in Power Query:
and here the code:
if [Brand]="Nissan" then [Brand] & " (" & [PC] & ")" else if [Brand]="Subaru" then [Brand] & " (" & [PC] & ")" else if [Brand]="Toyota" then [Brand] & " (" & [PC] & ")" else if [Brand]="Mazda" then [Brand] & " (" & [PC] & ")" else [Brand]Let me know if this works 🙂
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/ - 3 years ago
PXJ ,
Here a solution as a calculated column in DAX:
And here the code:
BrandCalculatedColumn = SWITCH ( TRUE, [Brand]="Nissan", [Brand] & " (" & [PC] & ")", [Brand]="Subaru", [Brand] & " (" & [PC] & ")", [Brand]="Toyota", [Brand] & " (" & [PC] & ")", [Brand]="Mazda", [Brand] & " (" & [PC] & ")", [Brand] )Hope either of the solution helps 🙂
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/ 🙂
tackytechtom
3 years agoMost Valuable Professional
PXJ ,
Here a solution as a calculated column in DAX:
And here the code:
BrandCalculatedColumn =
SWITCH (
TRUE,
[Brand]="Nissan", [Brand] & " (" & [PC] & ")",
[Brand]="Subaru", [Brand] & " (" & [PC] & ")",
[Brand]="Toyota", [Brand] & " (" & [PC] & ")",
[Brand]="Mazda", [Brand] & " (" & [PC] & ")",
[Brand]
)
Hope either of the solution helps 🙂
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/ 🙂
PXJ
3 years agoFrequent Visitor
Thanks very much Tom, it worked brilliantly. Really appreciate your response, I was struggling with it.