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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
James_Galis1
Helper I
Helper I

Sum max value

Hello

 

Hoping to get some assistance with a measure that adds up the value in the " Free time" column for each given date.

 

I use a date slicer which could show x number of days, weeks etc

 

The free time column represents available time for each respective date but should not be summing up all the values as it would give an inaccurate total of free time. Needing to add just 1 value from the " Free time" column for each date

 

The data is represented as follows:

 

Employee Start DateStart TimeEnd TimeFree Time
Emp 103/07/2023 07:00:008:00:002
Emp 103/07/2023 08:30:00 09:30:002
Emp 103/07/202310:00:00 11:30:002
Emp 103/07/2023 11:45:00 13:45:002
Emp 103/07/2023 14:30:0016:30:002
Emp 105/07/2023 08:30:00 09:30:001.75
Emp 105/07/2023 10:00:00 11:00:001.75
Emp 105/07/2023 11:30:00 13:30:001.75
Emp 105/07/202314:00:00 15:30:001.75
Emp 105/07/2023 15:45:00 17:45:001.75
Emp 104/07/2023 08:30:00 09:30:001.5
Emp 104/07/2023 09:45:00 10:45:001.5
Emp 104/07/2023 11:15:00 12:45:001.5
Emp 104/07/2023 13:00:00 14:00:001.5
Emp 104/07/2023 14:30:00 16:30:001.5

 

The expected results for each date would be

 

3/7/23 = 2

4/7/23 = 1.75

5/7/23 = 1.5

 

Total = 4.75

 

Would like to show the "Total" value on a card if possible

 

I have tried a number of solutions  but given that values for each date are the same any calculation seems to be adding up all the values for the respective date 

 

Appreciate the assistance

 

 

1 ACCEPTED SOLUTION
nickc_innova
Advocate I
Advocate I

You might try:

SUMX(
    SUMMARIZE('Table','Table'[Start Date], 'Table'[Free Time]), [Free Time])



View solution in original post

6 REPLIES 6
nickc_innova
Advocate I
Advocate I

You might try:

SUMX(
    SUMMARIZE('Table','Table'[Start Date], 'Table'[Free Time]), [Free Time])



eliasayyy
Super User
Super User

you can use sumx function

sumx(values([date]),max([amount]))

Hi

 

It does not seem to add up correctly

 

I get a total of 6 when looking at the data above

do you have multiple employees id?

Yes. I do have multiple emp ID's associated with the data

Sample data


 

Employee Start DateStart TimeEnd TimeFree TimeEmployee ID
Emp 103/07/20237:00:00 AM 08:00:0021678290
Emp 103/07/2023 08:30:00 09:30:0021678290
Emp 103/07/2023 10:00:0011:30:0021678290
Emp 103/07/2023 11:45:00 13:45:0021678290
Emp 103/07/2023 14:30:00 16:30:0021678290
Emp 104/07/20238:30:00 AM 09:30:001.51678290
Emp 104/07/2023 09:45:00 10:45:001.51678290
Emp 104/07/2023 11:15:00 12:45:001.51678290
Emp 104/07/2023 13:00:00 14:00:001.51678290
Emp 104/07/2023 14:30:0016:30:001.51678290
Emp 105/07/2023 08:30:00 09:30:001.751678290
Emp 105/07/2023 10:00:00 11:00:001.751678290
Emp 105/07/202311:30:00 AM13:30:001.751678290
Emp 105/07/2023 14:00:00 15:30:001.751678290
Emp 105/07/2023 15:45:00 17:45:001.751678290
Emp 204/07/2023 08:00:00 09:00:0042546973
Emp 204/07/20239:00:00 AM 10:00:0042546973
Emp 204/07/2023 14:00:00 15:00:0042546973
Emp 205/07/2023 13:30:00 15:30:0002546973
Emp 305/07/2023 10:00:0012:00:002.53753414
Emp 305/07/2023 14:30:0014:45:002.53753414

please try 

Breaks = SUMX(VALUES('Table'[Start Date]) , CALCULATE(MAX('Table'[Free Time]),ALLEXCEPT('Table','Table'[Start Date],'Table'[Employee ])))

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.