Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
hello everyone,
i am having a problem of distinguishing a 0/0 or null / null values from a 0/number values on a dashboard as they both shows as an empty cell, i would like to see the 0/2 valuse as a 0 and the null / null or 0/0 values as an empty cells , is there anyway to do that.
thanks .
Solved! Go to Solution.
See if this works for you (I've created separate measures for the numerator and denominator because it's easier to read, but you can do it all in one measure if you wish)
Divide Sales by Target =
SWITCH(
TRUE(),
AND(ISBLANK([Sum Sales]), [Sum Target] >0), 0,
[Sum Target] >0,
DIVIDE([Sum Sales], [Sum Target], 0),
DIVIDE([Sum Sales], [Sum Target]))
If you want blank when the target is blank even if there is a value for sales, you can use this measure:
Divide Sales by Target =
SWITCH (
TRUE (),
[Sum Target] > 0, DIVIDE ( [Sum Sales], [Sum Target], 0 ),
DIVIDE ( [Sum Sales], [Sum Target] )
)
BTW, you can simplify your measures by using the IN expression:
https://www.sqlbi.com/articles/understanding-the-in-operator-in-dax/
So, here is the equivalent to the measure your are using:
Sum using || =
CALCULATE (
SUM ( fTable[Sales] ),
fTable[Product] = "A"
|| fTable[Product] = "B"
|| fTable[Product] = "c"
)
and here is the simpler measure using the IN expression:
SUM using IN =
CALCULATE([Sum Sales], fTable[Product] IN {"A", "B", "C"})
and here is the comparison in a table visual:
I've attached a sample PBIX file
Proud to be a Super User!
Paul on Linkedin.
See if this works for you (I've created separate measures for the numerator and denominator because it's easier to read, but you can do it all in one measure if you wish)
Divide Sales by Target =
SWITCH(
TRUE(),
AND(ISBLANK([Sum Sales]), [Sum Target] >0), 0,
[Sum Target] >0,
DIVIDE([Sum Sales], [Sum Target], 0),
DIVIDE([Sum Sales], [Sum Target]))
If you want blank when the target is blank even if there is a value for sales, you can use this measure:
Divide Sales by Target =
SWITCH (
TRUE (),
[Sum Target] > 0, DIVIDE ( [Sum Sales], [Sum Target], 0 ),
DIVIDE ( [Sum Sales], [Sum Target] )
)
BTW, you can simplify your measures by using the IN expression:
https://www.sqlbi.com/articles/understanding-the-in-operator-in-dax/
So, here is the equivalent to the measure your are using:
Sum using || =
CALCULATE (
SUM ( fTable[Sales] ),
fTable[Product] = "A"
|| fTable[Product] = "B"
|| fTable[Product] = "c"
)
and here is the simpler measure using the IN expression:
SUM using IN =
CALCULATE([Sum Sales], fTable[Product] IN {"A", "B", "C"})
and here is the comparison in a table visual:
I've attached a sample PBIX file
Proud to be a Super User!
Paul on Linkedin.
Assuming the [RID ENI] measure is the division of [measure 1] by [measure 2], try:
RID ENI =
IF (
[measure 2] > 0,
DIVIDE ( [measure 1], [measure 2], 0 ),
DIVIDE ( [measure 1], [measure 2] )
)
Proud to be a Super User!
Paul on Linkedin.
Hi HifNi93
PowerBI will present the results of the numbers differently from a division, depending on if you use the "/" operator, or the divide() function.
See below experiment using some randomly generated data:
(1) Straight column (as opposed to measure): N/D = data[Numerator]/data[Denominator]
(2) Measure created using the "/" operator: sumN/sumD = sum(data[Numerator])/sum(data[Denominator])
(3) Measure created using the DIVIDE() function: Divide SumN SumD = divide(sum(data[Numerator]), sum(data[Denominator]))
The "/" operator returns the NaN or infinity, whereas the Divide() function cleans these results and returns blank It doesn't not matter whether it is a measure or Calculated column.
This means you can use the result of the "/" to tailor what output is returned.
This switch statement interprets the text returned by sumN/sumD and displays a custom string:
Note the values for NaN and Infinity are different when converted to a string!
Hope this gives you a few options.
Pi
thanks for your answer but actually nothing woks as i am using a calculate sum when i converted the results to strings it's still blanks
Can you tell how bo_value is calculated? I think the NaNs/ blanks are originating from there.
Bo_value is an orginal cloulmn, its numbers between 1-10
Looks like the blanks are coming from the original source. PowerBI would need more information in order to determine what type of non-real number it is.
Does the source contain the denominator? If the denonominator is present, then that could be compared with a switch statement instead.
The Denominator is also the Bo_value but with a different filter ,
Hi - in that case you just need to point an IF() statment at the denominator. Something similar to:
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
79 | |
79 | |
58 | |
36 | |
33 |
User | Count |
---|---|
93 | |
59 | |
59 | |
49 | |
41 |