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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
marcopaz
Frequent Visitor

Running Total with Blanks

Hello,

 

I've been trying to do a column to show running totals for two Contracts, and the problem I am facing is that sometimes different Contracts have different PeriodDate (date that the contract was paid, which is the PaidThisEstimate), which is causing these entries to be blank (instead of repeating the Cumulative). See the picture below (I wrote with red font the expected results):

 

marcopaz_0-1627957923274.png

 I tried a lot of different solutions I've seen in the forum, but none of them seems to be working, see below my Measure:

 

Cumulative Earnings Test2 = 
CALCULATE(
    SUM('Historical Earnings'[PaidThis Estimate]),
    FILTER(
        ALL('Calendar'[Date]),'Calendar'[Date]<=MAX('Calendar'[Date])))

 

Could you please help me ?

 

Thanks 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Mark your Date table as a date table in the model, then use this table to mean time in your visuals (by the way, you should never put any columns from your fact table on the canvas) and the measure you've shown above should work correctly. A good dimensional design (on which PBI has been founded) means  that you should have conformed dimensions and fact tables that are linked through dimensions. Also, your fact tables should be hidden from the end user. They should not be allowed to select columns from fact tables. A good fact table only stores keys to dimensions and facts (measurements). All measurements are exposed through measures and slicing is only allowed via dimensions.

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

One has to see your model to be able to tell you what's wrong. It looks like in your table you are using a different column of dates (Contract ID Date) than the calculation itself ('Calendar'[Date]). This is most likely where the problem lies. You should always be careful which columns you're dropping on the canvas and which you're using in your measures.

You are correct, I got a fact table with "PeriodDate", which has only the specific day in each month the contracts were paid, and then I have a calendar date table, see below:

 

marcopaz_0-1627993276479.png

 

My main goal is to be able to create a Scatter Chart which shows Contracts progression with regards to %Paid and %Duration used. I did the scatter chart and it worked well, but when I put the Play Axis, if a contract hasn't been paid in that specific month, it would dissapear from the scatter chart, see below:

 

marcopaz_1-1627993639721.png

As you can see above the there were a total of 7 Contracts in June 2021, however in July of 2021 only three contracts billed us, so then all the other contracts "dissappear" see below:

marcopaz_3-1627993869614.png

I would like the contract to still be shown in the scatter chart for months that they didn't bill us, that is why I am trying to get the Running Total fixed.

 

Anonymous
Not applicable

Mark your Date table as a date table in the model, then use this table to mean time in your visuals (by the way, you should never put any columns from your fact table on the canvas) and the measure you've shown above should work correctly. A good dimensional design (on which PBI has been founded) means  that you should have conformed dimensions and fact tables that are linked through dimensions. Also, your fact tables should be hidden from the end user. They should not be allowed to select columns from fact tables. A good fact table only stores keys to dimensions and facts (measurements). All measurements are exposed through measures and slicing is only allowed via dimensions.

You are right, when I did this data model I didn't have much experience with Power BI/Databases, but I am planning to do a good clean up on my tables to reduce the redundancy I got my files. I found a where the problem was, which was the fact that I had the calendar, the dimension and the fact tables all connected through "Both ways" relationship, which was messing it up due to the Crossfilters. But anyway, it looks like I need to put some work on optmizing the data model, but thanks for the solution.

amitchandak
Super User
Super User

@marcopaz , Try with this modification

Cumulative Earnings Test2 = 
CALCULATE(
    SUM('Historical Earnings'[PaidThis Estimate]),
    FILTER(
        ALL('Calendar'),'Calendar'[Date]<=MAX('Calendar'[Date])))

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I tried that and the same problem.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.