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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
AbhayB
Frequent Visitor

Help with Return IF function within a measure calculation

Hello Experts,

I am trying to complete a measure calculation, however, facing issue with below error -

"DAX comparison operations do not support comparing values of type True/False with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values."


Basically there are 2 calculations one for the employee and other for the contractor. I have horizontal bar chart, wherein I will be displaying the utilization per resource name. The chart has resource name on axis and on value place utilization ratio measure is used.
What is needed is, if Resource_type is Employee then use employee_utilization calculation else user other.


Here is my measure calculation -

Utilization_Ratio =

VAR Employee_Utilization = ( ('Table1'[Total_Days]) / (Another_Measure * 'Table1'[X_Column]) )*100

VAR Contractor_Utilization = ( ('Table1'[Total_Days]]) / (SUM('Table1'[Non_Billable_Hours]) + SUM('Table1'[Billable_Hours]) ) * 100 )

Return IF(ISFILTERED('Table1'[Resource_Type]) = "Employee", Employee_Utilization, Contractor_Utilization)

 

Kindly let me know where to apply the formatting to number as per the error.

 

Regards,

Abhay

 

4 REPLIES 4
AlB
Community Champion
Community Champion

Hi @AbhayB 

ISFILTERED('Table1'[Resource_Type]) yieds a boolean (TRUE/FALSE) value and you are comparing it to "Employee", which is text. That seems to be the cause for the error. IF it is a measure as you said, you probably need something like this instead:

SELECTEDVALUE('Table1'[Resource_Type]) = "Employee"

Please mark the question solved when done and consider giving kudos if posts are helpful.

 Cheers 

SU18_powerbi_badge

 

 

AbhayB
Frequent Visitor

Thanks. Worked it well.
Greg_Deckler
Community Champion
Community Champion

I think for this part:

 

 IF(ISFILTERED('Table1'[Resource_Type]) = "Employee", Employee_Utilization, Contractor_Utilization)

 

You want

 

IF(MAXX('Table1',[Resource_Type]) = "Employee" ...

 

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thanks for the reply. I tried it, however, it says parameter is not of correct type, and also cannot find [Resource_Type].

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.