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
naivecalf
Helper III
Helper III

How to use groupby and Max/Min

Hi,

 

I have a table, I want to groupby Category column, then find Minimum month, can anyone give some advise, thanks.

 

group by and min.jpg

Regards

Steven

2 ACCEPTED SOLUTIONS

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Anonymous
Not applicable

Hi  @naivecalf  ,

Here are the steps you can follow:

1. Create measure.

Measure =
var _rank=
RANKX(FILTER(ALLSELECTED('Table'),[Category]=MAX([Category])),CALCULATE(MAX('Table'[Date])),,ASC,Dense)
return
IF(_rank=1,MAX('Table'[Date]),BLANK())

2. Result

v-yangliu-msft_0-1607648185917.png

You can downloaded PBIX file from here.

 

Best Regards,

Liu Yang

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

9 REPLIES 9
Anonymous
Not applicable

Hi  @naivecalf  ,

Here are the steps you can follow:

1. Create measure.

Measure =
var _rank=
RANKX(FILTER(ALLSELECTED('Table'),[Category]=MAX([Category])),CALCULATE(MAX('Table'[Date])),,ASC,Dense)
return
IF(_rank=1,MAX('Table'[Date]),BLANK())

2. Result

v-yangliu-msft_0-1607648185917.png

You can downloaded PBIX file from here.

 

Best Regards,

Liu Yang

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

thank you, this is helpful to me.

naivecalf
Helper III
Helper III

please try.

CategoryDateName
a1/1/2020mike
a2/1/2020john
a3/1/2020west
e4/1/2020bob
f1/1/2020mark
e6/1/2020bill
f6/2/2020charle
d6/3/2020niud
a6/4/2020mike
b3/1/2020john
b4/1/2020west
b5/1/2020bob
b6/1/2020mark
f9/1/2020bill
f10/1/2020charle
f11/1/2020niud
f12/1/2020mary
b3/1/2020joy
a1/1/2020benben

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

thank you.

You are welcome.  If my reply helped, please mark it as Answer.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ashish_Mathur
Super User
Super User

Hi,

In the final result, do you want only Category and MonthN columns or do you want to see all columns?  Also, so you want a Query Editor or a DAX measures solution?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish,

 

Thanks you for quick responding, I need all columns, and I want to do it by using DAX measures. 

 

Regards

Steven

Hi,

Share data in a form that i can paste in MS Excel.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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
Top Kudoed Authors