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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
ciken
Resolver I
Resolver I

Want to return BLANK when running total equals total

Hi all - I'm building a running total from the quick measure tool but when the matrix comes across a column where the data would be blank - it's throwing the full value into the column and killing my report. 

 

EXAMPLE: I am working on a diminishing report of how many times patients order. One order would be the full amount of patients, then 2 would be smaller, then 3 smaller and so on. But, when it gets to a column where no patient exists, it throws the full amount (see chart for example). In 2022, most patients will only have bought 1 or maybe 2 times...but when it populates, 3, 4, 5 etc show the amount of patients enrolled instead of 0.

Can anyone help me figure out what I need to write in the formula to make it appear BLANK() instead of total?

 

Thanks


DAX: 

Count of Consumer ID running total in Orders on Autoship =
CALCULATE(
    DISTINCTCOUNT('Order Product'[Consumer ID]),
    FILTER(
        ALLSELECTED('Lead'[Orders on Autoship]),
        ISONORAFTER('Lead'[Orders on Autoship], MIN('Lead'[Orders on Autoship]), ASC)
    )
)

 DAX Issue.JPG

1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

Try:

Count of Consumer ID running total in Orders on Autoship =
IF (
    ISBLANK ( DISTINCTCOUNT ( 'Order Product'[Consumer ID] ) ),
    BLANK (),
    CALCULATE (
        DISTINCTCOUNT ( 'Order Product'[Consumer ID] ),
        FILTER (
            ALLSELECTED ( 'Lead'[Orders on Autoship] ),
            ISONORAFTER (
                    'Lead'[Orders on Autoship], MIN ( 'Lead'[Orders on Autoship] ), ASC
            )
        )
    )
)




Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

5 REPLIES 5
PaulDBrown
Community Champion
Community Champion

Try:

Count of Consumer ID running total in Orders on Autoship =
IF (
    ISBLANK ( DISTINCTCOUNT ( 'Order Product'[Consumer ID] ) ),
    BLANK (),
    CALCULATE (
        DISTINCTCOUNT ( 'Order Product'[Consumer ID] ),
        FILTER (
            ALLSELECTED ( 'Lead'[Orders on Autoship] ),
            ISONORAFTER (
                    'Lead'[Orders on Autoship], MIN ( 'Lead'[Orders on Autoship] ), ASC
            )
        )
    )
)




Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






This worked PERFECTLY! It removed all the totals when not necessary and gave me exactly what I needed.

 

Thanks @PaulDBrown 

 

DAX Issue.JPG

YukiK
Impactful Individual
Impactful Individual

You use functions like HASONEVALUE() or ISFILTERED() with the combination of IF().

 

Hope this helps!

I'm not sure what the DAX would look like - I tried to create my DAX as a variable and do an IF statement but it either didn't change, or errored out. 

 

Could you share what it might look like?

 

Thanks

 

YukiK
Impactful Individual
Impactful Individual

Try using HASONEVALUE() like this:

 

Measure =
VAR YourCalculateLogic = ...

VAR Result = IF(HASONEVALUE(table[Year]), YourCalculateLogicm Blank())

RETURN
Result

 

Or you can hide the total row in the setting:

Screen Shot 2022-02-26 at 8.20.07 PM.png

Consider giving a thumbs up if this is helpful!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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