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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
LS1700
Resolver I
Resolver I

Running total and null values

Hello,

 

I have some different tables with sales and I am building a new table with a coulmn where I entered the days of the month (1-31).

I managed to add measures to this table with the units sold for each day and the MTD (running total). 

for the MTD I uesd the formula :

 

MTD Invoiced = CALCULATE(SUM(Invoicing[Qty]),FILTER(ALLSELECTED(Invoicing),Invoicing[Day]<=MAX(Invoicing[Day])))

 this formulas works great! it also work with different filters.

 

The problem is that, if in the sales column there is no value, then in the MTD reports nothing.

How can I tell him, "if you find nothing, then bring the value from the previous row"? is that possible?

 

Below you can see what it is shown when rappresented in a table. 

Day 0, 1, 5 have zero sales. and the MTD is empty.

 

thanks

LS

 

 

 Capture.JPG

1 ACCEPTED SOLUTION

I found the solution!

 

Wrong: MTD Invoiced = CALCULATE(SUM(Invoicing[Qty]),FILTER(ALLSELECTED(Invoicing),Invoicing[Day]<=MAX(Invoicing[Day])))

 

Correct: MTD Invoiced = CALCULATE([Invoiced Qty],filter(ALLSELECTED('Table for Chart'),'Table for Chart'[Day Index]<=max('Table for Chart'[Day Index])))

 

As you can see, the second is referencedto the new table I created. now it show each time the MTD.

View solution in original post

3 REPLIES 3
Sean
Community Champion
Community Champion

Couple things you can try

 

1) Go to the Date filed in the Values area of the Table Visual => click the down arrow => select Show Items with No Data

 

2) Reference the Date column from your Calendar Table instead

 

MTD Invoiced =
CALCULATE (
    SUM ( Invoicing[Qty] ),
    FILTER (
        ALLSELECTED ( CalendarTable ),
        CalendarTable[Date] <= MAX ( CalendarTable[Date] )
    )
)
    + 0

The + 0 is optional but it will give you basically leading zeros if your Calendar Starts prior to any transactions and you want those dates to show 0.

For example first few days of a Year selected in a Slicer!

 

Running Total - Sample.png

 

Hope this helps! Smiley Happy

Hey,

 

thanks for your answer.

 

Show items with no data is already selected.

 

I cannot reference to the Date because I intentionally want to look at the day of the month. I want to compare the results with other months or other data (such as open orders...).

 

I appended to the invoice table 31 lines, so that I have all days of the month. Now it is a bit better, but as soon as I filter out (E.g. I select a specific area) I have null values.

 

The "+0" did not work either. it creates 0 values.

 

Any other suggestion?

 

thanks

LS

 

Capture.JPG

 

I found the solution!

 

Wrong: MTD Invoiced = CALCULATE(SUM(Invoicing[Qty]),FILTER(ALLSELECTED(Invoicing),Invoicing[Day]<=MAX(Invoicing[Day])))

 

Correct: MTD Invoiced = CALCULATE([Invoiced Qty],filter(ALLSELECTED('Table for Chart'),'Table for Chart'[Day Index]<=max('Table for Chart'[Day Index])))

 

As you can see, the second is referencedto the new table I created. now it show each time the MTD.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.