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
_Amy_
Frequent Visitor

DAX comparison operations

I have a DAX formula that calculates the number of employees who have departed in the last 12 months and it works well.

I am just trying to add to the formula an additional filter where the 'departure flag' equals 1 but it is giving me this error: 
'DAX compariosn operations do not support comparing values of type True/False with values of type Integer.' 

_Amy__0-1659926386887.png

Here is the DAX formula, with the additional part that is giving me the error I have added in red

 

Departed past 12 months =

 

VAR selectedDate = LASTDATE('Date Table'[Date])

VAR selectedDate12MonthsBefore = NEXTDAY(SAMEPERIODLASTYEAR(selectedDate))

 

RETURN

CALCULATE(

DISTINCTCOUNT('All Employees'[Full Name]),

FILTER(

ADDCOLUMNS(

'All Employees',

"Departed Past 12 months", IF([Termination Date]>=selectedDate12MonthsBefore && [Termination Date]<=selectedDate,1,0) && 'All Employees'[Departure Flag] = 1) ,[Departed Past 12 months] = 1))

 

I have tried to use the VALUE and FORMAT functions to change the Departure Flag and I have also changed it between text, whole number and 'any' in Power Query and I still get the same error every time.

Please help!

1 ACCEPTED SOLUTION

Thank you, I changed it around so the part of the formula that was causing the issue is now at the start of the formula and it works:

"Departed Past 12 months", IF  ('All Employees'[Departure Flag] = 1 && [Termination Date]>=selectedDate12MonthsBefore && [Termination Date]<=selectedDate,1,0)) ,[Departed Past 12 months] = 1))

View solution in original post

4 REPLIES 4
MahyarTF
Memorable Member
Memorable Member

You put the condition without checking it.

In my opinion, you need to put your condition in If Function against the out of it

Mahyartf

Thank you, I changed it around so the part of the formula that was causing the issue is now at the start of the formula and it works:

"Departed Past 12 months", IF  ('All Employees'[Departure Flag] = 1 && [Termination Date]>=selectedDate12MonthsBefore && [Termination Date]<=selectedDate,1,0)) ,[Departed Past 12 months] = 1))
amitchandak
Super User
Super User

@_Amy_ , Try like

 

"Departed Past 12 months", IF([Termination Date]>=selectedDate12MonthsBefore && [Termination Date]<=selectedDate && 'All Employees'[Departure Flag] = 1 && [Departed Past 12 months] = 1,1,0)

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

Thank you, I tried that but it didn't work.

The "[Departed Past 12 months]" is the name of the measure I am creating here so I can't use it in the formula like that. 

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