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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
k_r
Regular Visitor

How do I get the last non blank value in Running Totals?

Hi there,

I have a table of data consisting of Stock Quantity for various Materials over a period of time.

I am trying to create a visual for the Running Totals for each of these Materials throughout the years.
So far this is what I have :

 

k_r_0-1691070154129.png


I would like for the table to show the last non-blank value displayed wherever it shows blanks.

For example, for Material 19814, on 30 April 2023 it shows 35. However, for the subsequent dates it shows blanks until 31 July 2023. Can someone help me figure out a way to show the last non-blank value, 35, for those blanks?

The formula that I've used in the measure for Running Totals is as follows:

Running Total =
CALCULATE(
    SUM('ZPP_MULTI_MD04'[Reciept/Reqmt]),FILTER(ALLSELECTED('ZPP_MULTI_MD04'),

    'ZPP_MULTI_MD04'[New Date]<=MAX('ZPP_MULTI_MD04'[New Date])

    && 'ZPP_MULTI_MD04'[Material]=MAX('ZPP_MULTI_MD04'[Material])

    ))
 
Reciept/Reqmt denotes the Stock Quantity
ZPP_MULTI_MD04 is the table that holds the data
New Date is the column within the table that holds the dates

Thanks in advance!
2 REPLIES 2
k_r
Regular Visitor

@Greg_Deckler 

Thanks for the reply, sorry for not explaining myself properly.

 

What I'm trying to show is the stock movement by material per month. So I expect the quantity of the stock to be the same for each period until there is movement either in or out.

For example, my report shows stock 35 for material 19814 in April. I would expect to see a stock of 35 for May and June until the stock moves out in July where it shows 0 in my report.

Is there a way to show this in my table? 

Greg_Deckler
Super User
Super User

@k_r Given that this is a single table and not a separate date table, you will likely have better luck not using CALCULATE for this. Also, I don't see how what you currently have is a running total as the numbers are not consistently increasing.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.