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

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.

Reply
Anonymous
Not applicable

Convert formula to power query

Dears,

 

I need your support to help me transform the formula below to PQ format:

 

IF(AND([col1]<=50,[col1]>=0),"28.3",IF(AND([col1]>=51,[col1]<=75),"33.55",IF(AND([col1]<=100,[col1]>=76),"38.8",IF(AND([col1]>=101,[col1]<=200),"61.6",IF(AND([col1]>=201,[col1]<=400),"85.6",IF(AND([col1]>=401,[col1]<=500),"95.2",IF(AND([col1]>=501,[col1]<=700),"115.6",IF(AND([col1]>=701,[col1]<=900),"184.9","234.4"))))))))

 

 

Thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

You can add conditional columns.

12.png

 

Or add a custom column.

 

if [col1] <= 50 and [col1] >= 0 then "28.3" else if [col1]>= 51 and [col1] <= 75 then "33.55" else if [col1] <= 100 and [col1] >= 76 then  "38.8" else if [col1] >= 101 and [col1] <= 200 then "61.6" else if [col1] >= 201 and [col1] <= 400 then "85.6" else if [col1] >= 401 and [col1] <= 500 then "95.2" else if [col1] >= 501 and [col1] <= 700 then "115.6" else if [col1] >= 701 and [col1] <= 900 then "184.9" else "234.4" 

 

Screenshot 2021-07-20 163734.png

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

 

You can add conditional columns.

12.png

 

Or add a custom column.

 

if [col1] <= 50 and [col1] >= 0 then "28.3" else if [col1]>= 51 and [col1] <= 75 then "33.55" else if [col1] <= 100 and [col1] >= 76 then  "38.8" else if [col1] >= 101 and [col1] <= 200 then "61.6" else if [col1] >= 201 and [col1] <= 400 then "85.6" else if [col1] >= 401 and [col1] <= 500 then "95.2" else if [col1] >= 501 and [col1] <= 700 then "115.6" else if [col1] >= 701 and [col1] <= 900 then "184.9" else "234.4" 

 

Screenshot 2021-07-20 163734.png

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

ImkeF
Community Champion
Community Champion

Hi @Anonymous ,

the syntax has the following pattern:

if [col1] <= 50 and [col1] >= 0 then "28.3" else if ....

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Kudoed Authors