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
admin_xlsior
Post Prodigy
Post Prodigy

Can IF statement follow by calculation?

Hi guys,

 

If I have this table

admin_xlsior_0-1612327420894.png

 

how to add custom column saying that If [Toggle] = 1 then [Value]/10 else [Value]/10 * -1

I found the If statement only allow a fixed value, is that correct? 

 

I'm sorry but I never use Power query or M language before.

 

Thanks.

 

 

1 ACCEPTED SOLUTION
Jimmy801
Community Champion
Community Champion

Hello @admin_xlsior 

 

what you mean by fixed value?

the first parameter you can use also a list or table by applying a function like

if Table.RowCount(YourTable)= 1 then ....

and for the then end else you can use let/in and functions as well like

if [Toggle]=1 then 
let 
   FirstStep = .....,
   SecondStep = FirstStep + 1
in
   SecondStep

else
   null



If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

View solution in original post

2 REPLIES 2
Jimmy801
Community Champion
Community Champion

Hello @admin_xlsior 

 

what you mean by fixed value?

the first parameter you can use also a list or table by applying a function like

if Table.RowCount(YourTable)= 1 then ....

and for the then end else you can use let/in and functions as well like

if [Toggle]=1 then 
let 
   FirstStep = .....,
   SecondStep = FirstStep + 1
in
   SecondStep

else
   null



If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

hmm, yeah, I don;t know why it show error back then, but now is ok

admin_xlsior_0-1612335584787.png

Ok, thanks for comfirming.

 

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