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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
ouafaa
Helper II
Helper II

cumulate a mesure month by month from a startdate to an enddate

I have a measure Mesure1 that I calculate according to a chosen month and year.


now I want to use this mesure to calcul another mesure.
the rule is that when I choose a periode : startdate to enddate, the new mesure "Mesure2" should accumulate the result of the mesure1 for each month from the startdate to the enddate
and finally this result should be divided by the number of months that are includes on the periode between the startdate to the enddate


How can I do this with dax ?
thank you for any help

1 ACCEPTED SOLUTION

Hello,

 

It did not resolve my problem, perhaps because I did not know how to implement it for my case, but it inspired me to find another solution.

 

I created a calculated table (month, mesure1) and after that I was able to do the sum of the mesure month by month for a choosen period.

 

Thank you very much for your help

View solution in original post

2 REPLIES 2
ValtteriN
Community Champion
Community Champion

Hi,

Try something like this:


MTD with conditions =
var _sdate = MIN('Calendar example'[Date])
var _edate = MAX('Calendar example'[Date])
var months = DISTINCTCOUNT('Calendar'[Month]) return
DIVIDE(
CALCULATE(SUM(Aggregation[Duration(Secs)]),ALL('Calendar'),'Calendar'[Date]>=_sdate,'Calendar'[Date]<=_edate,DATESMTD('Calendar'[Date])),months)
 
Use second calendar for the selected period and have a relationship between your fact table and calendar.


ValtteriN_0-1645699143166.png




I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/





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

Proud to be a Super User!




Hello,

 

It did not resolve my problem, perhaps because I did not know how to implement it for my case, but it inspired me to find another solution.

 

I created a calculated table (month, mesure1) and after that I was able to do the sum of the mesure month by month for a choosen period.

 

Thank you very much for your help

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.