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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
SK1968
Regular Visitor

If statement with subtraction

Please can someone help with a problem I have

I have a table that has the following, Column 1 is 'Weekly hours', Column 2 is 'LA' - this is part of a calculated table called 'Hours Used'

SK1968_0-1737454987272.png

I would like to produce a table/column - not sure which to say that if the lA is Plymouth then the weekly hours are to be subtracted from 12 and if not then the weekly hours need to be subtracted from 11

 

Any help would be much appreciated

1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@SK1968 You can create a new calculated column using DAX

 

DAX
Adjusted Hours =
IF(
'Hours Used'[LA] = "Plymouth",
12 - 'Hours Used'[Weekly hours],
11 - 'Hours Used'[Weekly hours]
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

2 REPLIES 2
bhanu_gautam
Super User
Super User

@SK1968 You can create a new calculated column using DAX

 

DAX
Adjusted Hours =
IF(
'Hours Used'[LA] = "Plymouth",
12 - 'Hours Used'[Weekly hours],
11 - 'Hours Used'[Weekly hours]
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Thank you very much for your help.

Maybe you could help me with another query. With the results of that calculated column it is not giving the correct total in a table visual.

 

Do you know why that would be?

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!

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.