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
mtrevisiol
Helper V
Helper V

Calculate sum of max values

Hi everyone,

I've got this table:

mtrevisiol_1-1636993022938.png

 

that contains, for each "MOId" and for each Item, the list of operations done (with their timestart and time stop) and the number of pieces produced. 

 

Then I've got a simple calendar table:

mtrevisiol_2-1636993053454.png

 

My intent is to create a calculated column in the Calendar table, that contains the sum of the maximum values of the column "Pcs produced" for each MOId, Item and date (intended as TimeStart[Date]).

The ideal result would be:

DateSum of Maximums
10/11/2021

2818,90

11/11/20212447,17

 

Here are the .csv and .pbix files: https://www.dropbox.com/s/l7u31huv1fp3a5d/SUM%20of%20MAX.zip?dl=0

 

Thank you so much.

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure whether I understood your question correctly, but please check the below picture and the attached pbix file.

It is for creating a new column.

Picture2.png

 

Sum of Maximums CC =
VAR currentdate = 'Calendar'[Date]
VAR filterbycurrentdate_table =
FILTER ( 'SUM of MAX', 'SUM of MAX'[TimeStart - dateonly] = currentdate )
VAR groupby_max =
GROUPBY (
filterbycurrentdate_table,
'SUM of MAX'[MOId],
'SUM of MAX'[Item],
"@maxvalue", MAXX ( CURRENTGROUP (), 'SUM of MAX'[Pcs produced] )
)
RETURN
SUMX ( groupby_max, [@maxvalue] )

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

I am not sure whether I understood your question correctly, but please check the below picture and the attached pbix file.

It is for creating a new column.

Picture2.png

 

Sum of Maximums CC =
VAR currentdate = 'Calendar'[Date]
VAR filterbycurrentdate_table =
FILTER ( 'SUM of MAX', 'SUM of MAX'[TimeStart - dateonly] = currentdate )
VAR groupby_max =
GROUPBY (
filterbycurrentdate_table,
'SUM of MAX'[MOId],
'SUM of MAX'[Item],
"@maxvalue", MAXX ( CURRENTGROUP (), 'SUM of MAX'[Pcs produced] )
)
RETURN
SUMX ( groupby_max, [@maxvalue] )

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


@Jihwan_Kim this is exactly what I was looking for. Many thanks!

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.