Forum Discussion
pmcinnis
Helper III
6 years agoNeed DAX script to create new column from two other columns
In the table below, the column 'final result' is the new column that I need to produce from columns 'unit' and 'result'. The rules for creating 'final result' are: For unit x, final result = result...
- 6 years ago
Hi pmcinnis
try a new calculated column
final result = SWITCH(TRUE(), 'Table'[unit]="x",1000*'Table'[result], 'Table'[unit]="y",'Table'[result], 'Table'[unit]="z",'Table'[result]/1000, ISBLANK('Table'[unit]) && ISBLANK('Table'[result]),BLANK(), ISBLANK('Table'[unit]) && ISNUMBER('Table'[result]),'Table'[result], "Undefined" )do not hesitate to give a kudo to useful posts and mark solutions as solution
az38
Community Champion
6 years agoHi pmcinnis
try a new calculated column
final result = SWITCH(TRUE(),
'Table'[unit]="x",1000*'Table'[result],
'Table'[unit]="y",'Table'[result],
'Table'[unit]="z",'Table'[result]/1000,
ISBLANK('Table'[unit]) && ISBLANK('Table'[result]),BLANK(),
ISBLANK('Table'[unit]) && ISNUMBER('Table'[result]),'Table'[result],
"Undefined"
)
do not hesitate to give a kudo to useful posts and mark solutions as solution
pmcinnis
Helper III
6 years agoThanks for the quick reply, let me look into this