cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AlexEnergee3
New Member

DAX Calculate the Max for a Group with SUM

Hello,

the follow query

 

evaluate 
SUMMARIZECOLUMNS(
    Machines[BillOfResources],
    Machines[Name],
    FeedbackDetails[Code],
    FeedbackDetails[description],
    FeedbackDetails[DescriptionLocal],
    --"Number", CALCULATE(DISTINCTCOUNT(Feedbacks201801[FeedbackID]),Filter(Dates,Dates[TimeStamp]>=Date(2018,02,02)),Filter(Dates,Dates[TimeStamp]<=Date(2018,02,28)),Filter(Machines,Machines[BillOfResources]="Mold1")),
    "TotalPeriod", CALCULATE(Sum(Feedbacks201801[Period]),Filter(Dates,Dates[TimeStamp]>=Date(2018,02,02)),Filter(Dates,Dates[TimeStamp]<=Date(2018,02,28)),Filter(Machines,Machines[BillOfResources]="Mold1"))
)
order by [totalperiod] desc

 

return the follow result

 

BillOfResourcesNameCodeDescriptionDescriptionLocalTotalPeriod
Mold1Mold1.DryEntry52Alarm description 52Alarm local description 5221
Mold1Mold1.GreenCut31Alarm description 31Alarm local description 3120
Mold1Mold1.ConveyorsExitDryer114Alarm description 114Alarm local description 11416
Mold1Mold1.ConveyorsExitDryer1Alarm description 1Alarm local description 115
Mold1Mold1.Dry28Alarm description 28Alarm local description 2815
Mold1Mold1.CutExit18Alarm description 18Alarm local description 1815
Mold1Mold1.Lamgea125Alarm description 125Alarm local description 12515
Mold1Mold1.CutExit118Alarm description 118Alarm local description 11815
Mold1Mold1.Lamgea60Alarm description 60Alarm local description 6015
Mold1Mold1.CutExit15Alarm description 15Alarm local description 1515
Mold1Mold1.ConveyorsExitDryer55Alarm description 55Alarm local description 5515
Mold1Mold1.CutExit66Alarm description 66Alarm local description 6615
Mold1Mold1.Dry8Alarm description 8Alarm local description 815
Mold1Mold1.DryEntry19Alarm description 19Alarm local description 1915
Mold1Mold1.Lamgea77Alarm description 77Alarm local description 7714

 

I need to obtain the Max Total Period column grouped by Name column

 

Can anyone help me?

 

Thanks!

1 REPLY 1
v-xjiin-msft
Solution Sage
Solution Sage

Hi @AlexEnergee3,

 

In your scenario, you can using SUMMARIZECOLUMNS() function to create a new calculated table. Right?

 

Then to achieve your requirement, you can create a new measure in this new calculated table. The expression is like:

 

MAX Total Period =
CALCULATE ( MAX ( Table[TotalPeriod] ), ALLEXCEPT ( Table, Table[Name] ) )

Thanks,
Xi Jin.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power BI October Update 2021.jpg

Power BI Release

Click here to read more about the October 2021 Release!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Teds Dev Camp Oct. 2021 768x460.jpg

Power BI Dev Camp - October 28th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!