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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Bambang_Sono
Frequent Visitor

Cumulative average per day in power bi

Please ask, I want to make a table to find the cumulative average tonnage based on date and month in Power BI, like the following picture:

and this is the dax formula I can't get:
Release Average = CALCULATE(
AVERAGE(DataRelease[TONAGE]),
DataRelease[Date] = EARLIER(DataRelease[Date]))

 

help.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Bambang_Sono ,
Thanks for ryan_mayu and bhanu_gautam reply.

You can also try the follwing code to create a calculate column

Avg per days = 
VAR CurrentDate = 'Table'[Date]
VAR CurrentMonth = 'Table'[Month]
VAR CurrentTonase = 'Table'[Tonase]
VAR DaysUntilCurrentDate = COUNTROWS(FILTER('Table', 'Table'[Month] = CurrentMonth && 'Table'[Date] <= CurrentDate))
VAR CumulativeTonase = 
    CALCULATE(
        SUM('Table'[Tonase]),
        FILTER(
            'Table',
            'Table'[Month] = CurrentMonth &&
            'Table'[Date] <= CurrentDate
        )
    )
RETURN
    CumulativeTonase / DaysUntilCurrentDate

Final output

vheqmsft_0-1739327054090.png

 

Best regards,
Albert He


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

4 REPLIES 4
Anonymous
Not applicable

Hi @Bambang_Sono ,
Thanks for ryan_mayu and bhanu_gautam reply.

You can also try the follwing code to create a calculate column

Avg per days = 
VAR CurrentDate = 'Table'[Date]
VAR CurrentMonth = 'Table'[Month]
VAR CurrentTonase = 'Table'[Tonase]
VAR DaysUntilCurrentDate = COUNTROWS(FILTER('Table', 'Table'[Month] = CurrentMonth && 'Table'[Date] <= CurrentDate))
VAR CumulativeTonase = 
    CALCULATE(
        SUM('Table'[Tonase]),
        FILTER(
            'Table',
            'Table'[Month] = CurrentMonth &&
            'Table'[Date] <= CurrentDate
        )
    )
RETURN
    CumulativeTonase / DaysUntilCurrentDate

Final output

vheqmsft_0-1739327054090.png

 

Best regards,
Albert He


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

@Bambang_Sono 

you can try this

 

Column = AVERAGEX(FILTER('Table','Table'[Month]=EARLIER('Table'[Month])&&'Table'[Date]<=EARLIER('Table'[Date])),'Table'[Tonase])

 

11.PNG

pls see the attachment below





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

Proud to be a Super User!




bhanu_gautam
Super User
Super User

@Bambang_Sono , Try using

 

DAX
Release Average =
VAR CurrentDate = DataRelease[Date]
RETURN
CALCULATE(
AVERAGE(DataRelease[TONAGE]),
FILTER(
ALL(DataRelease),
DataRelease[Date] <= CurrentDate
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






What if it's combined with the summarize function?

example of my dax formula:
Average Release =
VAR CurrentDate = DataRelease[Date].[Date]
RETURN
CALCULATE(
AVERAGEX(DataRelease[TONAGE]),
SUMMARIZE(
FILTER(
ALL(DataRelease),DataRelease[Date].[Date] <= CurrentDate)
)

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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