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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
MacarenaGB
Helper II
Helper II

Filtering and calculation issues

Hi everyone

 

I have a table with the effort tracking in man-days of the employees related to the date and I am trying to join this info with their cost, but I need to associate the time of the Holidays to the other projects prorrated to the man-days.

In excel should be like this (example):

Screenshot_1.png

 

 

 

 

 

 

Here you have the initial result in power BI and the result applying the measure detailed belowPowerBi.pngFormula.png

As you can see the result is not correct

Can anyone help me?

 

Thanks

 

 

 

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @MacarenaGB ,

 

Believe the best option would be to have the holidays out of your table but having that value on your table you should do your measure similar to this one:

Adjusted Cost = 
var Holidays_unit_value =
DIVIDE (
    CALCULATE (
        SUM ( 'Table'[Cost] ),
        FILTER ( ALL ( 'Table'[Project Name] ), 'Table'[Project Name] = "Holidays" )
    ),
     (
        CALCULATE ( SUM ( 'Table'[Cost] ), ALL ( 'Table'[Project Name] ) )
            - CALCULATE (
                SUM ( 'Table'[Cost] ),
                FILTER ( ALL ( 'Table'[Project Name] ), 'Table'[Project Name] = "Holidays" )
            )
    )
)

var SalaryCost = DIVIDE(SUM('Table'[Cost]),SUM('Table'[Man-Days]))
Return
COALESCE (
    IF (
        ISINSCOPE ( 'Table'[Project Name] ),
        IF (
            SELECTEDVALUE ( 'Table'[Project Name] ) = "Holidays",
            BLANK (),
            SUM ( 'Table'[Man-Days] ) * SalaryCost
                + (
                    SUM ( 'Table'[Man-Days] ) * Holidays_unit_value * SalaryCost
                )
        ),
        SUM ( 'Table'[Cost] )
    ),
    0
)

 

See result below:

MFelix_0-1612461930373.png

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





View solution in original post

1 REPLY 1
MFelix
Super User
Super User

Hi @MacarenaGB ,

 

Believe the best option would be to have the holidays out of your table but having that value on your table you should do your measure similar to this one:

Adjusted Cost = 
var Holidays_unit_value =
DIVIDE (
    CALCULATE (
        SUM ( 'Table'[Cost] ),
        FILTER ( ALL ( 'Table'[Project Name] ), 'Table'[Project Name] = "Holidays" )
    ),
     (
        CALCULATE ( SUM ( 'Table'[Cost] ), ALL ( 'Table'[Project Name] ) )
            - CALCULATE (
                SUM ( 'Table'[Cost] ),
                FILTER ( ALL ( 'Table'[Project Name] ), 'Table'[Project Name] = "Holidays" )
            )
    )
)

var SalaryCost = DIVIDE(SUM('Table'[Cost]),SUM('Table'[Man-Days]))
Return
COALESCE (
    IF (
        ISINSCOPE ( 'Table'[Project Name] ),
        IF (
            SELECTEDVALUE ( 'Table'[Project Name] ) = "Holidays",
            BLANK (),
            SUM ( 'Table'[Man-Days] ) * SalaryCost
                + (
                    SUM ( 'Table'[Man-Days] ) * Holidays_unit_value * SalaryCost
                )
        ),
        SUM ( 'Table'[Cost] )
    ),
    0
)

 

See result below:

MFelix_0-1612461930373.png

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.