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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.