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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
RonaldvdH
Post Patron
Post Patron

Problem with my formula

Guys, i hope you can help me out here.

 

I use this formula to calculate the SUM of a colum which contains values and it works but it's in the Date table

 

Running Total number of sales =
CALCULATE (
SUM('Date'[salesdate]),
FILTER (
ALL ( 'Date' ),
'Date'[Date] <= MAX( 'Date'[Date])
))

 

However i need it to work not just with numbers but with a countrows and ive already tried it but it doesn't seem to work in another Table.

Basically i have a colum that has a date in it if something was sold and now i need a running total measure based on a relationship between SALES and DATE but i think my formula is wrong

 

Running Total number of sales =
FILTER(
ALLNOBLANKROW('Sales'[salesdate]),
FILTER (
ALL ( 'Date' ),
'Date'[Date] <= MAX( 'Date'[Date])
))

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @RonaldvdH 

I build a sample to show you how to get running total from another table.

Sales:

1.png

Date:

Date =
ADDCOLUMNS (
    CALENDARAUTO (),
    "Year", YEAR ( [Date] ),
    "Month", MONTH ( [Date] ),
    "MonthName", FORMAT ( [Date], "MMMM" )
)

Relationship: Date[Date] —— Sales[SalesDate] 

2.png

Measure:

Measure = 
CALCULATE(
COUNTROWS(Sales),
FILTER(ALL('Date'),'Date'[Date]<=MAX('Date'[Date])),
FILTER(ALL(Sales),Sales[SalesDate] <>BLANK())
)+0

Blank in SalesDate column will cause blank in columns in Date table in visual, due to relationship. Remove blank in Date column in Filter Field. Result is as below. 

3.png

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @RonaldvdH 

I build a sample to show you how to get running total from another table.

Sales:

1.png

Date:

Date =
ADDCOLUMNS (
    CALENDARAUTO (),
    "Year", YEAR ( [Date] ),
    "Month", MONTH ( [Date] ),
    "MonthName", FORMAT ( [Date], "MMMM" )
)

Relationship: Date[Date] —— Sales[SalesDate] 

2.png

Measure:

Measure = 
CALCULATE(
COUNTROWS(Sales),
FILTER(ALL('Date'),'Date'[Date]<=MAX('Date'[Date])),
FILTER(ALL(Sales),Sales[SalesDate] <>BLANK())
)+0

Blank in SalesDate column will cause blank in columns in Date table in visual, due to relationship. Remove blank in Date column in Filter Field. Result is as below. 

3.png

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

ryan_mayu
Super User
Super User

@RonaldvdH 

could you pls provide the sample data and expected output?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.

Top Solution Authors