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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
fturmo
Frequent Visitor

Calculate Minimum Payment per Hour

Dear all,

 

I am trying to create a measure to do the following:

 

I have some people that they have a minimum paid units of 5 Units/Hour. This means that if the do more, there is no payment and if they do less we only pay for the difference (they did 3 then we need to calculate the extra 2).

 

I need to do a report to show how many extra units we paid per worker. The problem is that they can have more than one line per hour and that i need to sumarize the report per day and not per hour. I would also appreciate if is possible to summarize per different workers.

 

I have a database with the following information:

 

Worker IDDayReporting HourUnits
122/08/2017151
122/08/2017151
222/08/2017153
322/08/2017152
422/08/2017155
322/08/2017151
522/08/2017158
122/08/2017161
222/08/2017163
322/08/2017162

 

I try to create a measure with an intermediary table with the filter per day and then apply If Sumx(intermediate table)>3,3-Sumx(), but then i am a little bit lost on how to do it if i want to aggregate the full day.

 

Another option will be to create a calculated column with the "extra payment" and then do a sum, but i do not know how to create a formula in each column to Sum the total units with the filter of hour, day and worker ID.

 

I am quite new with the Power BI and i would appreciate if someone can give me some indications on how I need to approach it.

 

Thanks,

 

Francesc.

1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey,

 

I'm not sure if I totally understand your requirement, but here you'll find a little pbix file

 

I created two calculated columns and one measure

Worked Units - this columns sums the units per Worker | Day | Hour

Worked Units = 
CALCULATE(
	SUM('Table1'[Units])
	,ALLEXCEPT('Table1',Table1[Worker ID],'Table1'[Day],Table1[Reporting Hour])
) 

I changed the default aggregation to Average.

 

The 2nd calculated column just calculates the extra payment. This column is hidden from the Report View

 

The Measure "Extra Payment" calculates the measure that is applicable for each worker | day | hour

Extra Payment = 
CALCULATE(
	SUMX(
	SUMMARIZE('Table1',Table1[Worker ID],Table1[Day],Table1[Reporting Hour],"ExtraPayement", AVERAGE(Table1[Extra Payments]))
	,[ExtraPayement])
)

 This measure aggregates the calculated column "Extra Payment" using the AVERAGE() function.

This is inside the SUMX() so that Worker 1 has an Extra Payment of 7, 3 from working hour 15 and 4 from workig hour 16.

 

Hope this is what you are looking for

Regards



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

2 REPLIES 2
TomMartens
Super User
Super User

Hey,

 

I'm not sure if I totally understand your requirement, but here you'll find a little pbix file

 

I created two calculated columns and one measure

Worked Units - this columns sums the units per Worker | Day | Hour

Worked Units = 
CALCULATE(
	SUM('Table1'[Units])
	,ALLEXCEPT('Table1',Table1[Worker ID],'Table1'[Day],Table1[Reporting Hour])
) 

I changed the default aggregation to Average.

 

The 2nd calculated column just calculates the extra payment. This column is hidden from the Report View

 

The Measure "Extra Payment" calculates the measure that is applicable for each worker | day | hour

Extra Payment = 
CALCULATE(
	SUMX(
	SUMMARIZE('Table1',Table1[Worker ID],Table1[Day],Table1[Reporting Hour],"ExtraPayement", AVERAGE(Table1[Extra Payments]))
	,[ExtraPayement])
)

 This measure aggregates the calculated column "Extra Payment" using the AVERAGE() function.

This is inside the SUMX() so that Worker 1 has an Extra Payment of 7, 3 from working hour 15 and 4 from workig hour 16.

 

Hope this is what you are looking for

Regards



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Thanks Tom for your suggestion it works perfectly.

 

Francesc.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

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.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.