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

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.

Reply
TaylorLile
Frequent Visitor

Display 0 Instead of blank

Hello,

I know this question has been posted before, but I've tried their solutions and they don't work for me. I'm trying to caclulate the number of distinct presription codes per patient by using the following:

 

Perscriptions = (CALCULATE(DISTINCTCOUNT(Claims[RxCd]),ALLEXCEPT(Claims,Claims[patient_id])) - 1)
 
This is working perfectly, except the patient IDs that are in other tables and not in the claims table show up as blank and dissapear. Is there a way to dispay as 0, not blank?
 
I've tried doing an IF statement like below, but it doesn't change anything. I'm not sure why. 
 
IF(ISBLANK(
(CALCULATE(DISTINCTCOUNT(Claims[RxCd]),ALLEXCEPT(Claims,Claims[patient_id])) - 1)),0,CALCULATE(DISTINCTCOUNT(Claims[RxCd]),ALLEXCEPT(Claims,Claims[patient_id])) - 1)
 
Thanks for any help you can provide. 
 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Let's try in this way
 
Perscriptions =
VAR pr = CALCULATE(DISTINCTCOUNT(Claims[RxCd]),ALLEXCEPT(Claims,Claims[patient_id])) - 1

RETURN IF(pr == BLANK() || pr <= 0, 0, pr)

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi,

 

Please try the formula IF(TableName[ColumnName]<=10,"100","0")

Anonymous
Not applicable

Let's try in this way
 
Perscriptions =
VAR pr = CALCULATE(DISTINCTCOUNT(Claims[RxCd]),ALLEXCEPT(Claims,Claims[patient_id])) - 1

RETURN IF(pr == BLANK() || pr <= 0, 0, pr)
VasTg
Memorable Member
Memorable Member

@TaylorLile 

 

Maybe move the calculate into a variable and check the variable as blank.

 

Post some sample data to better assist you.

Connect on LinkedIn

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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