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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Anonymous
Not applicable

Return the date where the sum of values is maximum

Hi, 

 

I have a table with some purchases. Each purchase has a date, a customer and a value:

Date              Customer    Value
02/05/2022Kevin53
02/05/2022Mary12
02/05/2022Louise43
03/05/2022Tom19
03/05/2022Lewis24
04/05/2022Richard28
04/05/2022Rachel52

 

I'd like to build a visualization that returns the date where the sum of Value column is the maximum. 

The sum of purchases for 02/05/2022 is 108 (53+12+43).

The sum of purchases for 03/05/2022 is 43 (24+19)

The sum of purchases for 04/05/2022 is 80 (28+52).

 

So, in my card visualization, I want to show "02/05/2022", because 108>80>43. 

At the moment, I have achieved the value of the sum of purchases corresponding to this date, with this DAX formula:

 

Sum Maximum Value = 

    MAXX(
        SUMMARIZE(
            ALL('Table') ,
            Table[Date]
        ) ,
        CALCULATE(Sum('Table'[Value])
    ) )

 

 

But I'm not able to build a measure that returns the Date value corresponding to this Sum Maximum Value. 

Could you help me?

Regards

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

Hi, @Anonymous ;

Try it.

Sum Maximum Value = MAXX( SUMMARIZE('Table',[Date],"1",SUM([Value])),[1])

The final output is shown below:

vyalanwumsft_0-1652090795860.png


Best Regards,
Community Support Team _ Yalan Wu
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

3 REPLIES 3
v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

Try it.

Sum Maximum Value = MAXX( SUMMARIZE('Table',[Date],"1",SUM([Value])),[1])

The final output is shown below:

vyalanwumsft_0-1652090795860.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

CNENFRNL
Community Champion
Community Champion

For fun only, make it dynamic.

DAX.gif

 Also with mighty Excel worksheet formula,

CNENFRNL_0-1651693866048.gif


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

amitchandak
Super User
Super User

@Anonymous , Use TOPN

Create total measure

Total = CALCULATE(Sum('Table'[Value])

Top total with date in visual
Top1 total= CALCULATE([Total],TOPN(1,allselected(Table[Date]),[Total] ,DESC),VALUES(Table[Date]))

 

Top date to display
Top1 Date =CALCULATE(max(Table[Date])),TOPN(1,allselected(Table[Date]),[Total] ,DESC),VALUES(Table[Date]))

 

 

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.