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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
fredSPE
New Member

How to generate monthly totals by year

How to generate monthly totals by year, for example:
year          month           value           monthlytotals

2023            1                    2                       2

2023            3                    3                       5

2023            4                    1                       6

2023            12                  8                       12

2022            2                    5                       5

2022            3                    3                       8

2022            4                    7                       15

2022            11                  9                       24

monthlytotals is what I need to find

1 ACCEPTED SOLUTION
Dangar332
Super User
Super User

hi, @fredSPE 

try below 

monthlytotal =
var a = MAX(total[month])
var b = CALCULATE(SUM(total[value]),total[month]<=a,ALLEXCEPT(total,total[year]))
return
b
 
 

Dangar332_0-1697828472221.png

 

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

 

View solution in original post

2 REPLIES 2
Dangar332
Super User
Super User

hi, @fredSPE 

try below 

monthlytotal =
var a = MAX(total[month])
var b = CALCULATE(SUM(total[value]),total[month]<=a,ALLEXCEPT(total,total[year]))
return
b
 
 

Dangar332_0-1697828472221.png

 

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

 

thank you i have supprime MAX function and tacking only a=total[month] and is ok.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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