Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
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)
)
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |
| User | Count |
|---|---|
| 7 | |
| 5 | |
| 5 | |
| 5 | |
| 4 |