Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have a calculation on two measures, SUM('QGenda Compliance'[CompliantClockIn/Out])/SUM('QGenda Compliance'[RequiredClockIn/Out]) resulting in NaN because the denominator can be 0. I've been trying to fix this with:
Overall Compliance = IF(SUM('QGenda Compliance'[RequiredClockIn/Out])=0,0,SUM('QGenda Compliance'[CompliantClockIn/Out])/SUM('QGenda Compliance'[RequiredClockIn/Out])) which works to get rid of NaN but it has other strange effects. I have a report with a matrix and some line graphs filtered by a date range of June - September. When I change this formula these visuals then show the entire date range, say Jan - Dec, but has a 0 for every month except June - September. Why does it change it to show the entire date range and not just what the user picks on the slider?
Solved! Go to Solution.
Hi @Anonymous ,
According to my understand , you want to diaplay the measure result based on Months selected in Slicer , right?
You could use the following formula:
Overall Compliance =
IF (
'QGenda Compliance'[RequiredClockIn/Out] = 0,
0,
'QGenda Compliance'[CompliantClockIn/Out] / 'QGenda Compliance'[RequiredClockIn/Out]
)
Or use DIVIDE()
Overall Compliance =
DIVIDE (
'QGenda Compliance'[CompliantClockIn/Out],
'QGenda Compliance'[RequiredClockIn/Out]
)
The matrix visual and line chart look like this:
Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.
Best Regards,
Eyelyn Qin
Hi @Anonymous ,
According to my understand , you want to diaplay the measure result based on Months selected in Slicer , right?
You could use the following formula:
Overall Compliance =
IF (
'QGenda Compliance'[RequiredClockIn/Out] = 0,
0,
'QGenda Compliance'[CompliantClockIn/Out] / 'QGenda Compliance'[RequiredClockIn/Out]
)
Or use DIVIDE()
Overall Compliance =
DIVIDE (
'QGenda Compliance'[CompliantClockIn/Out],
'QGenda Compliance'[RequiredClockIn/Out]
)
The matrix visual and line chart look like this:
Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.
Best Regards,
Eyelyn Qin
@Anonymous
have you tried DIVIDE function?
https://docs.microsoft.com/en-us/dax/divide-function-dax
Proud to be a Super User!
@Anonymous Can you use Blank() instead of zero. I hope it works for you
IF(SUM('QGenda Compliance'[RequiredClockIn/Out])=0,Blank(),SUM('QGenda Compliance'[CompliantClockIn/Out])/SUM('QGenda Compliance'[RequiredClockIn/Out]))
Proud to be a Super User!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
94 | |
83 | |
66 | |
59 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |