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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
gingerclaire
Helper III
Helper III

DAX to subract an amount for only one person?

Hi,

 

I am working on a Power BI report to work out how many working days each person has in a month.

 

I have been able to get to the stage where I have subtracted weekend, sick leave, holiday and bank holidays - but I have one person who does not work mondays.

 

At the moment I am using the following measure to count total working days:

(A-B) Working days minus days out = ('Date table'[A - Total working days])-CALCULATE(SUM(Leave[B - Total working days out of action]))

 

I have a separate measure to count the number of Mondays - but I cannot figure out how to subtract the [No. of Mondays] from just her total? Please help!

 

I want to show in a table:

 

NameTotal working days in month
Person A22
Person B (who doesn't work mondays18
1 ACCEPTED SOLUTION
v-easonf-msft
Community Support
Community Support

Hi, @gingerclaire 

If you just want to subtract the [No. of Mondays] from just Person B total, please add a new measure like:

Result1 =
IF (
    MAX ( 'Table'[Name] ) = "Person B",
    // MAX ( 'Table'[Name] ) IN { "Person B", "Person xx" },
    [Total working days in month],
    [Total working days in month] - [No. of Mondays]
)

 

Best Regards,
Community Support Team _ Eason

View solution in original post

3 REPLIES 3
v-easonf-msft
Community Support
Community Support

Hi, @gingerclaire 

If you just want to subtract the [No. of Mondays] from just Person B total, please add a new measure like:

Result1 =
IF (
    MAX ( 'Table'[Name] ) = "Person B",
    // MAX ( 'Table'[Name] ) IN { "Person B", "Person xx" },
    [Total working days in month],
    [Total working days in month] - [No. of Mondays]
)

 

Best Regards,
Community Support Team _ Eason

This worked - thank you so much! Only problem is I can't get the totals to show the 'correct' amount in the table (common measures issue but I don't quite understand how to fix it no matter how much time I spend reading about it!)

amitchandak
Super User
Super User

@gingerclaire , for the workday of the month you can use networkdays and customize it as per each person 

 

https://amitchandak.medium.com/power-bi-dax-function-networkdays-5c8e4aca38c

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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