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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors