Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
GeorgeGokmen
Helper I
Helper I

New Column with IF Logic and Excel Syntax

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))))))))

 

 

IndexPhasefirst fourSection
10001-000000010-250
20002-000000020-250
30003-000000030-250
40004-000000040-250
50004-100000040-250
60005-000000050-250
70005-100000050-250
22469000-152090009000
22479000-153090009000
22489000-154090009000
22519999-900099999999
22529999-996099999999
22539999-997099999999
22549999-999999999999

 

1 ACCEPTED SOLUTION
Vijay_A_Verma
Most Valuable Professional
Most Valuable Professional

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)
            )

 

View solution in original post

1 REPLY 1
Vijay_A_Verma
Most Valuable Professional
Most Valuable Professional

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)
            )

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.