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! Learn more

Reply
Anonymous
Not applicable

Need help on DAX

Hi,

I need a help in creating two measures, when two years are selected from year slicer, I want to calculate

 

Measure-1: the HeadCount number for Min selected year

Measure-2: the Headcount number  for Max selected year. 

The Head Count measure is already calculated in CalculatedMeasures Table.


2 REPLIES 2
ValtteriN
Super User
Super User

Hi,

Try something like this:

MIN_Count = var _minY = MIN(Calendar[Year]) return

CALCULATE(COUNT(Table[Emp_id],ALL(Table[Date]),YEAR(Table[Date])= _minY)




MAX_Count = var _maxY = MAX(Calendar[Year]) return

CALCULATE(COUNT(Table[Emp_id],ALL(Table[Date]),YEAR(Table[Date])= _maxY)



I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Thanks for the reply, But if use COUNT(Table[Emp_id],ALL(Table[Date]),YEAR(Table[Date])= _maxY) expression, It will give the wrong Headcount number.

Can't we use Measure (Measure name is HeadCount) directly in the expression?

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.