cancel
Showing results for
Did you mean:

## Maximum hours of activities

Hello friends. How are you?. I'm already having a headache trying to fix a problem in power bi. I have dealt with tables, formulas and I do not succeed. I need to know the maximum of a set of shifts according to dates. Here is an example:

 Date Shift Employees 28-mar-2023 A 12 28-mar-2023 A 10 28-mar-2023 B 8 28-mar-2023 B 6 29-mar-2023 A 4 29-mar-2023 B 2 30-mar-2023 A 5 30-mar-2023 A 7 30-mar-2023 B 6

And the solution I need from maximums is:

 Date Shift Employees 28-mar-2023 A 12 28-mar-2023 B 8 29-mar-2023 A 4 29-mar-2023 B 2 30-mar-2023 A 7 30-mar-2023 B 6

I hope that is understood. Thank you very much and hug

Sergio

4 REPLIES 4

Thanks, I couldn't find the PBIX, what is the name?

Solution Sage

final

final.pbix

Super User

here is a more simple solution. The most simple solution is to use implicit measures, meaning to change the aggregation function from SUM (the default function for numeric columns) to MAX:

1. Open the context menu (right click)
2. Select the aggregation function you want

The default aggregation function can be changed in the Power BI dataset, or you can change the aggregation function per visual, of course, it's possible to mix both settings as needed.

The DAX statement below is the simplest to calculate a measure returning the MAX value. Measures are considered explicit measures, whereas changing the aggregation function creates implicit measures:

``````Employees (MAX) =
CALCULATE( MAX( 'Table'[Employees] ) ) ``````

If your users can access your Power BI dataset with "Analyze in Excel," then you need explicit measures.

Hopefully, this helps to tackle your challenge.

Regards,

Tom

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
Solution Sage

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
https://1drv.ms/f/s!AiUZ0Ws7G26RhgCvMt2xlt4fkBtc?e=r5U9I2

Announcements

#### Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

#### Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

#### Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

#### Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors
Top Kudoed Authors