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
Anonymous
Not applicable

Return the values from a column that satisfy the conditions based on another columns

Let's say that I have a table which contains 4 columns - participant name, fiscalyear, email, shareinfo. I want to display the email of only those participants who want to share their info and fiscalyear equal to current year. 

 

I can do it easily in sql using case statement - CASE WHEN (shareinfo=1 and FiscalYear = YEAR(GETDATE())) THEN email END AS Email. 

 

I tried using similar approach in powerbi using "if" statement but it is giving me 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."

 

I'm writing this query - if(Query1[shareinfo]=true() & Query1[FiscalYear]=YEAR(TODAY()),Query1[email],"null")

 

Is there any other to achieve the desired result?

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

Please correct me if I wrongly understood your question.

Please try the below.

 

query =
IF (
Query1[shareinfo] = TRUE ()
&& Query1[FiscalYear] = YEAR ( TODAY () ),
Query1[email],
"null"
)

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

Linkedin: https://www.linkedin.com/in/jihwankim1975/


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Anonymous
Not applicable

@Jihwan_Kim Thank you for your response! This doesn't seem to work since shareinfo and fiscalyear are of different data types. Shareinfo is of true/false data type and fiscalyear of whole number. I tried creating new columns by converting these two columns into text data type, but it still gives me the same 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"

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.