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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
astano05
Helper III
Helper III

Measure to Display 0 if blank and 1 if not blank

I want to create a measure to display 0 if a specified field for a record is blank, and 1 if it is not blank. I want to show this for each record. I think this might be better as a column, but if I can do it as a measure that is preferred as I dont have direct edit access to the model to add a column. 

 

I tried the below, but it tells me the resources exceeded

if(isblank(SELECTEDVALUE(Contacts[Email])),0,1)
4 REPLIES 4
Sahir_Maharaj
Super User
Super User

Hello @astano05,

 

The SELECTEDVALUE method expects a scalar result to be returned, however it is being used in a context that produces many values, which is why you are receiving a resource exceeded error. You can use the IF function in its place to get around this problem.

 

Can you try this: 

 

Measure =
IF(
    ISBLANK(MAX(Contacts[Email])),
    0,
    1
)

 

This measurement determines if the Email column's maximum value in the current context is blank. The measure returns 0 if it is, while returning 1 otherwise.


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning
DanielGarcia
Advocate I
Advocate I

Good nigth man, 
So, to do this the best way is in a column because do you need a value to every line. 

 

Try two ways:

Column

Way1 = if(Contacts[Email] is blank, 0,1)

measure
Way2 = 
     var email = SELECTEDVALUE(Contacts[Email])
     var test = if(email is blank,0,1)
      return test

 

Please tell us the result!

Thank you for responding! 

 

The measure doesn't give me the result I'm looking for, it returns a 0 for every value.

Good morning, so, the value Contacts[Email] is blank in all rows? 

Can you send a print or a video?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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
Top Kudoed Authors