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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Reetz
Helper II
Helper II

Error handling with DAX

Silly question, but Is there a way to write a DAX formula to show a message  instead of the error box?  I've tried iferror, but I still get this error box.  I'd like to display "0%" or "value not available" instead.Capture.PNG

 

Thanks!!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Use the HASONEVALUE or HASONEFILTER function to discover whether one, no or more values have been selected and build a conditional logic to display what you want in each case.

Best
D

View solution in original post

6 REPLIES 6
Greg_Deckler
Community Champion
Community Champion

I think there is also ISERROR but it suffers the same limitations.


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...
Greg_Deckler
Community Champion
Community Champion

Well, it depends on the error if iferror can catch it or not. What is the error you are getting? If it is trying to compare different data types, that is one of the errors it doesn't catch but I created a work-a-round for it somewhere on this community. It was regarding strict and loose comparisons.


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...

@Greg_Deckler Thanks for the quick reply!  I am getting a "calculation error in measure: A table of multiple values was supplied where a single value was expected." 

 

My table has a column with 2 values, "Pre-implementation" and "Post-implementation".  My measure calculates totals based on these values.  I also have a slicer for these values.  The totals are accurate if either Pre or Post implementation is chosen in the slicer but I get the error when both are chosen.

Anonymous
Not applicable

Use the HASONEVALUE or HASONEFILTER function to discover whether one, no or more values have been selected and build a conditional logic to display what you want in each case.

Best
D

@Reetz So what should happen if both are chosen? You can check for this condition by using HASONEVALUE and avoid the error.



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...

If both are chosen, I'm trying to show "Pre/Post Implementation" and the total of everything.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.