Forum Discussion
Is Blank DAX
Hi,
I've below DAX but I'm not getting continues line on visual. How to input 0 if my values are blank/missing.
I"m doing Count of ID from CM table with filtered by Not Overdue from [Overdue / Not overdue] column.
My Current DAX:
- Anonymous5 years ago
This one fixed my problem.
% Completion = if(ISBLANK([NotOverDue])&& NOT(ISBLANK([Overdue_CM])),0,CALCULATE(COUNT(CM[ID]),CM[Overdue / Not overdue]="Not Overdue")/CALCULATE((COUNT(CM[ID]))))
8 Replies
- AllisonKennedy
Community Champion
Anonymous You can always just add 0 to the measure, but this will impact how it behaves with filters and will show 0 for any scenario where values are blank/missing (which is what you asked) but if you want to apply other filters, just come back with more info and we can help.
My Current DAX:
CALCULATE(count(CM[ID]),CM[Overdue / Not overdue]="Not Overdue") / CALCULATE((COUNT(CM[ID]))) + 0 - amitchandak
Super User
Anonymous , Try like
divide(CALCULATE(count(CM[ID]),CM[Overdue / Not overdue]="Not Overdue") , CALCULATE((COUNT(CM[ID]))),0)
Or
divide(CALCULATE(count(CM[ID]),CM[Overdue / Not overdue]="Not Overdue") , CALCULATE((COUNT(CM[ID]))),0) +0
- AnonymousNot applicable
Hi,
Both approachs are not working.
1st one had no changes
2nd one all value remains zero. any other help?
- amitchandak
Super User
Anonymous ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
- AnonymousNot applicable
Hi Anonymous ,
It is suggested to use DIVIDE function. The DIVIDE function was designed to automatically handle division by zero cases. If an alternate result is not passed in, and the denominator is zero or BLANK, the function returns BLANK. When an alternate result is passed in, it's returned instead of BLANK.
Try this:
VAR tt =
DIVIDE (
CALCULATE ( COUNT ( CM[ID] ), CM[Overdue / Not overdue] = "Not Overdue" ),
CALCULATE ( ( COUNT ( CM[ID] ) ) )
)
RETURN
IF ( ISBLANK ( tt ), 0, tt )Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
Hi Anonymous ,
Could you tell me if your problem has been solved?
If it is, kindly Accept it as the solution. More people will benefit from it.
Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.
Best Regards,
Stephen Tao - AnonymousNot applicable
Hi, The below screenshot explains my issue. For some of my NoOverdue has no values which results blank Percentage values. which is why I'm not getting continues line graph.
Sorry for the delayed respose. Many thanks
I get error when I try to create a variable with return function.
- AnonymousNot applicable
This one fixed my problem.
% Completion = if(ISBLANK([NotOverDue])&& NOT(ISBLANK([Overdue_CM])),0,CALCULATE(COUNT(CM[ID]),CM[Overdue / Not overdue]="Not Overdue")/CALCULATE((COUNT(CM[ID]))))