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
Morten_DK
Helper I
Helper I

When running total is zero then blank

I have a calculation of accounts receivables

 

 

Receivables  = 
VAR MaxDate = MAX ( 'Date'[Date] )
VAR NowDate = Today()
RETURN
    CALCULATE (
        'Receivables'[Receivables Amount Posted],           
        'Date'[Date] <= MaxDate && 'Date'[Date] <= NowDate, 
        Removefilters ( 'Date' )      

 

 

Which works just fine, but once the customer has paid then the receivables is zero (also correct), but I would like to get those removed from my visual.

 

For example invoice "A" is issued in Jan 23 and paid in Mar23, so it will look like this:

MonthInvoiceReceivables
jan-23A100
feb-23A100
mar-23A0
apr-23A0
maj-23A0
jun-23A0
jul-23A0
aug-23A0
sep-23A0
okt-23A0
nov-23A0
dec-23A0

 

I would like it to be blank when zero. I have tried an if

= if(Receivables[Receivables]<>0, Receivables[Receivables]) that works partly, but not on aggregated to customer level.
3 REPLIES 3
johnt75
Super User
Super User

Try

Receivables =
VAR MaxDate =
    MAX ( 'Date'[Date] )
VAR NowDate =
    TODAY ()
VAR Result =
    CALCULATE (
        'Receivables'[Receivables Amount Posted],
        'Date'[Date] <= MaxDate
            && 'Date'[Date] <= NowDate,
        REMOVEFILTERS ( 'Date' )
    )
RETURN
    IF ( Result <> 0, Result )

Thanks for the feedback - I think it is close. It doesn't change that I still get zeros included, but if I instead of 

 

 

IF ( Result <> 0, Result )

 

 

Change it to

 

 

 

IF (  OR(Result < -1,Result >1), Result )

 

 

 

Then I don't get all the zeros anymore (but obviously not anything between -1 and 1 either), so my change is not a solution, but I can't grasp why the measure you propose does work fine, but just not when it should be different to zero. If I use different that 0.99 it also doesn't work, it has to be 1

My guess would be that it is not returning exactly 0 but instead it rounds to 0. Use Performance Analyzer to get the DAX code for the table or matrix visual and run it in DAX Studio.

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.