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
pmadam
Helper II
Helper II

Help division error

Hi All,

 

I am trying to divide two text columns for a particluar dimension. So i get error when the numerator or denominator has blank value. I went forward and added if clause as below but i still get below error . 

 

Kindly sugest 

 

XY =
IF(ISBLANK([DSAM Amount]) && Not ISBLANK(VALUE([Customer Target])) <> "", 0 ,
(
([Customer Target] /
[DSAM Amount])))
 
 
division error.png

 

 

1 ACCEPTED SOLUTION

@pmadam Maybe:

XY =
IF(
  ISBLANK([DSAM Amount]) && Not(ISBLANK(VALUE([Customer Target]))), 
  0 ,
  [Customer Target] / [DSAM Amount]
)


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

View solution in original post

8 REPLIES 8
pmadam
Helper II
Helper II

Hi @Greg_Deckler ,

 

I get error. These measures are in text because when i added comma seperator, the measures were converted to type int to text.

 

Reply.png

@pmadam , Your measure should be divide( [Customer Target],[DSAM Amount],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

@pmadam Maybe:

XY =
IF(
  ISBLANK([DSAM Amount]) && Not(ISBLANK(VALUE([Customer Target]))), 
  0 ,
  [Customer Target] / [DSAM Amount]
)


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

@pmadam you have the wrong syntax for DIVIDE:

 

@Greg_Deckler 's code:  XY =DIVIDE( [Customer Target], [DSAM Amount], 0 )

 

Your code: XY =DIVIDE( [Customer Target] / [DSAM Amount] ,0 ). 

 

Even if you didn't throw an error with one of your "numbers" being empty, you are dividing by 0.

 

Hope this helps

David

Hi @pmadam ,

 

Are bot of your columns numeric which you are trying to divide.

DIVIDE is function that works on non-text values. If you think logically, how can you divide a text value by a numeric value.

 

Try modifying data type of your text column used in DIVIDE function to Numeric.

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Anonymous
Not applicable

@pmadam

Why are you outputting numbers as text? This is not how you do stuff correctly. If you want to format a number in a visual, please use the formatting options in the ribbon, not the FORMAT function.
Anonymous
Not applicable

The error says it all: you cannot compare bool values with text. Makes no sense... Here's how to use IF: IF( <logical_condition>, <case_for_True>, <case_for_False> ). You cannot do this True <> "". This comparison is not defined.
Greg_Deckler
Community Champion
Community Champion

@pmadam Use the DIVIDE function like this (get rid of the IF clause)

 

XY =DIVIDE([Customer Target],[DSAM Amount],0)
 
Third parameter is the one to return in case of divide by zero.


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

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.