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

Return max from rows

Hello guys,

 

I am new with DAX and Power BI so maybe you could help me with this use case.

I have a table with employee id and Month.

I would like to calculate the count of employeeID based on the latest/max from the column Month.

 

EmployeeIDMonth
101
202
303
404
505
606
707
807

 

After executing the right measure the result would be :

MonthNew Measure
011
021
031
041
051
061
072

 

Any suggestions?

 

Kind regards,

Rega

1 ACCEPTED SOLUTION
dobregon
Impactful Individual
Impactful Individual

@rsanyoto 

So, do you want to have a unique value that give to you the count of employees in the last month that you have in the databse automatically, right?

To do that, you can do 2 measures

Max month = max(month) --> This give to you the max number of month in your table (maybe you need to combine with year if you want to analyse different years). in that case you need to create a column Year-Month like (2020-01) and then the max like Max period = max(year-month)

Then you can do a calculate measure to count by last period

calculate(count(employee), filter(table, year-month column = measure max period))




Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

View solution in original post

5 REPLIES 5
dobregon
Impactful Individual
Impactful Individual

@rsanyoto 

So, do you want to have a unique value that give to you the count of employees in the last month that you have in the databse automatically, right?

To do that, you can do 2 measures

Max month = max(month) --> This give to you the max number of month in your table (maybe you need to combine with year if you want to analyse different years). in that case you need to create a column Year-Month like (2020-01) and then the max like Max period = max(year-month)

Then you can do a calculate measure to count by last period

calculate(count(employee), filter(table, year-month column = measure max period))




Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)
amitchandak
Super User
Super User

@rsanyoto , You are trying to filter the data for month 12, there is no data for month 12, someother logic is rquired.

 

Can you please elaborate the problem you are facing

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

Hi guys,

 

What if my month column from 1(january) -12 (december)?

 

I was thinking like:

 

CALCULATE([Total Employee],'TableEmpoyee'[Month] = "12")
AllisonKennedy
Super User
Super User

@rsanyoto  You can just create a measure: 

 

Total Employees = COUNT(Table[EmployeeID])

 

Then create a table visualization. Put Table[Month] and [Total Employees] in the visual. 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

amitchandak
Super User
Super User

@rsanyoto , with this data it should be

 

count(Table[EmployeeID])

 

or

distinctcount(Table[EmployeeID])

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