This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
How can I create and add a new column in Power BI to mimick the excel formulas below?
=IF(NUMBERVALUE(C2)<=250,"0-250",IF(NUMBERVALUE(C2)<=500,"251-500",IF(NUMBERVALUE(C2)<=750,"501-750",IF(NUMBERVALUE(C2)<=1000,"751-1000",IF(NUMBERVALUE(C2)<=1250,"1001-1250",IF(C2="2000","2000",IF(C2="9000","9000",LEFT(C2,4))))))))
| Index | Phase | first four | Section |
| 1 | 0001-0000 | 0001 | 0-250 |
| 2 | 0002-0000 | 0002 | 0-250 |
| 3 | 0003-0000 | 0003 | 0-250 |
| 4 | 0004-0000 | 0004 | 0-250 |
| 5 | 0004-1000 | 0004 | 0-250 |
| 6 | 0005-0000 | 0005 | 0-250 |
| 7 | 0005-1000 | 0005 | 0-250 |
| 2246 | 9000-1520 | 9000 | 9000 |
| 2247 | 9000-1530 | 9000 | 9000 |
| 2248 | 9000-1540 | 9000 | 9000 |
| 2251 | 9999-9000 | 9999 | 9999 |
| 2252 | 9999-9960 | 9999 | 9999 |
| 2253 | 9999-9970 | 9999 | 9999 |
| 2254 | 9999-9999 | 9999 | 9999 |
Solved! Go to Solution.
For First Four, use following DAX formula and change the column to Whole Number
First Four = LEFT('Table'[Phase],4)
For Section, use following DAX formula
SWITCH(
TRUE(),
'Table'[First Four]<=250,"0-250",
'Table'[First Four]<=500,"251-500",
'Table'[First Four]<=750,"501-750",
'Table'[First Four]<=1000,"751-1000",
'Table'[First Four]<=1250,"1001-1250",
'Table'[First Four]=2000,"2000",
'Table'[First Four]=9000,"9000",
LEFT('Table'[First Four],4)
)
For First Four, use following DAX formula and change the column to Whole Number
First Four = LEFT('Table'[Phase],4)
For Section, use following DAX formula
SWITCH(
TRUE(),
'Table'[First Four]<=250,"0-250",
'Table'[First Four]<=500,"251-500",
'Table'[First Four]<=750,"501-750",
'Table'[First Four]<=1000,"751-1000",
'Table'[First Four]<=1250,"1001-1250",
'Table'[First Four]=2000,"2000",
'Table'[First Four]=9000,"9000",
LEFT('Table'[First Four],4)
)
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.