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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

SUMX, GroupBy Date and find Max count and related Hour value

Hello All,

 

I have below data. 

I want to find PeakHour and PeakCount for each date.

PeakHour meaning highest number of SUM(In_Count)  for each date .

 

peakhour-1.PNG

 

-----------------

for example - in below image I filtered data for March 01, where pickhour is 13 and Pickcount is 3318. 

 

peakhour-2.PNG

so I might need 2 more columns for each date it will show pick hour and pick count. 

I undesratnd I might have to use SUMX but just cant figure our DAX for it. 

Thanks  

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I created data to reproduce your scenario.

Table:

d1.png

 

You may create two measures as below.

 

InCountPeak = 
SUMX(
    ADDCOLUMNS(
        SUMMARIZE(
            'Table',
            'Table'[Date]
        ),
    "Max_InCount",CALCULATE(MAX('Table'[In_Count]))
    ),
    [Max_InCount]
)

HourPeak = 
SUMX(
    ADDCOLUMNS(
        SUMMARIZE(
            'Table',
            'Table'[Date]
        ),
        "Max_hour",CALCULATE(MAX('Table'[Hour]))
    ),
    [Max_Hour]
)

 

 

Result:

d2.png

 

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I created data to reproduce your scenario.

Table:

d1.png

 

You may create two measures as below.

 

InCountPeak = 
SUMX(
    ADDCOLUMNS(
        SUMMARIZE(
            'Table',
            'Table'[Date]
        ),
    "Max_InCount",CALCULATE(MAX('Table'[In_Count]))
    ),
    [Max_InCount]
)

HourPeak = 
SUMX(
    ADDCOLUMNS(
        SUMMARIZE(
            'Table',
            'Table'[Date]
        ),
        "Max_hour",CALCULATE(MAX('Table'[Hour]))
    ),
    [Max_Hour]
)

 

 

Result:

d2.png

 

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

amitchandak
Super User
Super User

@Anonymous ,

Not very clear. In case you are looking for Sum of max. Use

sumx(Summmarize(Table,Table[Date],"_max",max(Table[In_count])),[_max])

 

Also Refer : https://community.powerbi.com/t5/Desktop/SUM-of-AVERAGE/td-p/197013

In this case you need sum of max

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors