Forum Discussion
Need help on DAX
Hi,I have data as below in the second picture. I need to create a calculated column based on the values of enter_by.1,enter_by.2 and so on. The data also has a region_id column. Have a mapping table as in picture1.
Would like to create something like below based on the information I have -
if [region_id]=1 then
(if [enter_by.1]="ODB" then "ODB" else if [enter_by.2]="ODB" then "ODB" else if [enter_by.3]="ODB" then "ODB" else if [enter_by.4]="ODB" then "ODB" else if [enter_by.5]="ODB" then "ODB" else if [enter_by.6]="ODB" then "ODB" else if [enter_by.7]="ODB" then "ODB" else if [enter_by.8]="ODB" then "ODB" else if [enter_by.9]="ODB" then "ODB" else if [enter_by.10]="ODB" then "ODB" else if [enter_by.11]="ODB" then "ODB" else if [enter_by.12]="ODB" then "ODB" else if [enter_by.13]="ODB" then "ODB" else if [enter_by.14]="ODB" then "ODB" else if [enter_by.16]="ODB" then "ODB" else if [enter_by.17]="ODB" then "ODB" else if [enter_by.18]="ODB" then "ODB" else if [enter_by.19]="ODB" then "ODB" else if [enter_by.20]="ODB" then "ODB" else if [enter_by.21]="ODB" then "ODB" else if [enter_by.22]="ODB" then "ODB" else if [enter_by.23]="ODB" then "ODB" else if [enter_by.24]="ODB" then "ODB" else if [enter_by.25]="ODB" then "ODB" else if [enter_by.26]="ODB" then "ODB" else if [enter_by.27]="ODB" then "ODB" else if [enter_by.28]="ODB" then "ODB" else null)
else
if [region_id]=2 then
(if [enter_by.1]="BDB" then "BDB" else if [enter_by.2]="BDB" then "BDB" else null)
else null
Any ideas will be really helpfule. Please let me know for more clarifications.
3 Replies
- parry2kSuper User
Anonymous what you want to achieve the end result? Just calculated column? How you want to use it? THe formula you showed what is the problem wiht that?
- AnonymousNot applicable
Thanks for replying.
Can I achieve something like this using DAX?
I had written the formula in Power Query and was working there.
What about using nested ifelse in DAX for a calculated column?
WHat is the best practice?
- parry2kSuper User
Anonymous yes you can surely achieve the same with DAX
My Column in Dax = if( Table[Column] = Value, <then condition>, if( Table[Column] = Valie, <then condition>, <else condition> ) )