Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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)
)
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 15 | |
| 14 | |
| 9 | |
| 9 | |
| 8 |