Forum Discussion
Comparing a Column with Strings with a specific Value
Good Morning,
i am new to PowerBi and i want to adopt an Excel formula to PowerBi.
The formula in Excel is as follows:
=IF(M2="R4";I2;IF(M2="R3";J2;IF(M2="R2";K2;IF(M2="R1";L2))))
and here a picture of the table:
My question is how do i convert this formula to DAX, because i want an extra column (in Excel Column N) that is showing the specific value of the cell with regard to whether the row belongs to R1,R2,R3 or R4
My attempt looks like this, but an error is always returned:
I hope somebody can help me.
Thanks a lot
Greetings Lukas
Hi Anonymous ,
Can I suggest you using a conditional column in Power Query first to get your desired column.
Did I help you today? Please accept my solution and hit the Kudos button.
3 Replies
- davehusMemorable Member
Hi Anonymous ,
Can I suggest you using a conditional column in Power Query first to get your desired column.
Did I help you today? Please accept my solution and hit the Kudos button.
- AnonymousNot applicable
Hey davehus,
thank you for your reply.
I dont use Power Query. In the past, I exported the raw Power Bi data to Excel and then adjusted it there. Now I want to store the required calculations directly in Power Bi, which come from SAP. Or am I missing something?
- davehusMemorable Member
Hi Anonymous ,
You do use powerquery, you just may not have noticed. 🙂 It is the editor that is used when you click transofrm data in powerbi. Once you import your data, go to transform in the powerquery editor and select conditional column, you can use it to build an if statement based on your needs and select a column rather than a value to get data from each column based on the price.
Hope this helps