cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

Problem with multiplying hours per pay rate

Hello! So I am working on a project and trying to mutliply employee hours by their pay rate based on pay grade but I seem to be having an issue. I've tried using SUMX * SUM but its giving me widly massive numbers like 25M and my total should be around 565K.  I have two tables with MANY*MANY relationship using PAY GRADE. I think I am using the wrong formula specifically SUM Hrly rate, any help would be very appreciated!  

 

Pay Measure = SUMX('Hours','Hours'[Hours]) * SUM('PAY RATES'[Hrly Rate])

 

hours.PNGtotals.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Problem with multiplying hours per pay rate

Hi @mrmiyagi ,

 

Sorry, it was complicated by me. Just try this:

 

1. Create [Pay Measure 1].

 

Pay Measure 1 = SUM( 'Hours'[Hours] ) * SUM ( 'PAY RATES'[Hrly Rate] )

 

 

2. Create [Pay Measure 2].

 

Pay Measure 2 = 
IF (
    HASONEVALUE ( Hours[Employee ID] ),
    [Pay Measure 1],
    SUMX ( Hours, [Pay Measure 1] )
)

 

 

sum.PNG

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Highlighted
Super User IV
Super User IV

Re: Problem with multiplying hours per pay rate

This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907


---------------------------------------

Putting square pegs in round holes since 1972.

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




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

Proud to be a Super User!




Highlighted
Community Support
Community Support

Re: Problem with multiplying hours per pay rate

Hi @mrmiyagi ,

 

Create the measure like so:

 

Pay Measure 2 = 
VAR table_ =
    SUMMARIZE (
        Hours,
        Hours[Employee ID],
        Hours[Pay Grade],
        Hours[Hours],
        'PAY RATES'[Hrly Rate],
        "Sum_", [Hours] * [Hrly Rate]
    )
RETURN
    IF (
        HASONEVALUE ( Hours[Employee ID] ),
        SUMX ( 'Hours', 'Hours'[Hours] ) * SUM ( 'PAY RATES'[Hrly Rate] ),
        SUMX ( table_, [Sum_] )
    )

 

pay.PNG

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Highlighted
Helper II
Helper II

Re: Problem with multiplying hours per pay rate

Hello, 

 

Thanks for the reponse and help! I tried using the measure you provided but I am unable to select 'PAY RATES' table it is not listed when I try to add the last line in SUMMARIZE. I noticed your pbix has a 1*1 relationship but mine is MANY*MANY is that why?  Also worth noting that on my HOURS table each employee has multiple rows of hours

 

PAY RATES'[Hrly Rate],

 

Highlighted
Community Support
Community Support

Re: Problem with multiplying hours per pay rate

Hi @mrmiyagi ,

 

Sorry, it was complicated by me. Just try this:

 

1. Create [Pay Measure 1].

 

Pay Measure 1 = SUM( 'Hours'[Hours] ) * SUM ( 'PAY RATES'[Hrly Rate] )

 

 

2. Create [Pay Measure 2].

 

Pay Measure 2 = 
IF (
    HASONEVALUE ( Hours[Employee ID] ),
    [Pay Measure 1],
    SUMX ( Hours, [Pay Measure 1] )
)

 

 

sum.PNG

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Helper II
Helper II

Re: Problem with multiplying hours per pay rate

Thank you so much this is exactly what I needed! 

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors