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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Barkop_1
Frequent Visitor

Need explanation of how MAX() function works with Text Column

Hello,

 

I have found  multiple dax masures where MAX() is used with Text column, but none of the found solution explained how exactly does it work.

For example I was looking for measure that would return name of the month that had the highest sales value during respective year.

I implemented this measure into my .pbix (fount this on community): 

Best month = calculate(Max('Date'[MonthName]) ,TOPN(1,all('Date'[MonthName]),calculate([SalesUnits] )), values('Date'[MonthName]))
and it works as intended. Screenshots below.
 
Could someone explain how does the MAX() work with Text Columns?
 

Barkop_1_1-1715765719884.png

 

 

 

 

1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

MAX on a text value uses alphabetical order to return a scalar value.

In the measure shown, it's not "really" doing anything, TOPN is returning a table with 1 value -  just preventing a syntax error due to measures requiring an aggregation. 

If there were 2 months with the same SalesUnits, it would give you the later month in the alphabet eg, sep ahead of feb

View solution in original post

1 REPLY 1
HotChilli
Super User
Super User

MAX on a text value uses alphabetical order to return a scalar value.

In the measure shown, it's not "really" doing anything, TOPN is returning a table with 1 value -  just preventing a syntax error due to measures requiring an aggregation. 

If there were 2 months with the same SalesUnits, it would give you the later month in the alphabet eg, sep ahead of feb

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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