Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
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[Brand]="Subaru", Products[Brand]&" "&"("&Products[PC]&")",Products[Brand]
IF(Products[Brand]="Toyota", Products[Brand]&" "&"("&Products[PC]&")",Products[Brand]
IF(Products[Brand]="Mazda", Products[Brand]&" "&"("&Products[PC]&")",Products[Brand]
Products
Brand | PC |
Nissan | 123 |
Subaru | 456 |
Toyota | 789 |
Mazda | 987 |
Audi | 654 |
BMW | 658 |
Mercedes | 321 |
Nissan | 951 |
Subaru | 753 |
Toyota | 852 |
Mazda | 258 |
Brand1 |
Nissan (123) |
Subaru (456) |
Toyota (789) |
Mazda (987) |
Audi |
BMW |
Mercedes |
Nissan (951) |
Subaru (753) |
Toyota (852) |
Mazda (258) |
Thanks for your help.
Solved! Go to Solution.
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/
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! |
#proudtobeasuperuser |
@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/ 🙂
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! |
#proudtobeasuperuser |
@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/ 🙂
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! |
#proudtobeasuperuser |
Thanks very much Tom, it worked brilliantly. Really appreciate your response, I was struggling with it.
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/
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! |
#proudtobeasuperuser |
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
92 | |
87 | |
84 | |
65 | |
49 |
User | Count |
---|---|
140 | |
114 | |
110 | |
59 | |
59 |