Forum Discussion
gauravnarchal
5 years agoPost Prodigy
Measure - If condition
Hello - I need your help to create a measure to find the number in the table and return a value based on the condition.
Condition
If the invoice number starts with 9 return “CRN” and If the Invoice number starts with 8 return “INV” else VOD
Thanks
Gaurav
InvoiceNumber
| 87689789 |
| 87690239 |
| 97690689 |
| 97691139 |
gauravnarchal
If you need a measure, use this :Measure 1 = SWITCH( LEFT(SELECTEDVALUE(Table[InvoiceNumber]),1) , "9", "CRN" , "8" , "INV" , "VOD" )
For a column, use this code:Column 1 = SWITCH( LEFT(Table[InvoiceNumber],1) , "9", "CRN" , "8" , "INV" , "VOD" )
2 Replies
- smpa01Community Champion
Column = IF(LEFT(CONVERT('Table 1 (2)'[Column1],STRING),1)="8", "INV",IF(LEFT(CONVERT('Table 1 (2)'[Column1],STRING),1)="9", "CRN","VOD")) - FowmySuper User
gauravnarchal
If you need a measure, use this :Measure 1 = SWITCH( LEFT(SELECTEDVALUE(Table[InvoiceNumber]),1) , "9", "CRN" , "8" , "INV" , "VOD" )
For a column, use this code:Column 1 = SWITCH( LEFT(Table[InvoiceNumber],1) , "9", "CRN" , "8" , "INV" , "VOD" )