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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
NielsBakker
Frequent Visitor

How to sum an average per day measure to monthly level?

Hi! 

 

Currently, for my forecast I've created a measure that is based on the average cost of last and current month. This is an average per day and is a flat line for the future. See below the result, the dotted line is the correct forecast and is 10.627:

NielsBakker_1-1712831584173.png

 

Now my problem is when I drill down to a monthly level in my graph, the forecast will stay at the daily level. So at the 10.267 instead of summing all the days... 

NielsBakker_2-1712831810511.png

 

I'm using the following measure:

Forecast per day:=
VAR NumDaysPrevPeriod = DATEDIFF(EOMONTH(Today(),-2),Today(),DAY)
VAR PriorMonthCost = CALCULATE([Totals Per Cost Type (Resource)],REMOVEFILTERS(vwDimDateUsage),DATESBETWEEN(vwDimDateUsage[Date],EOMONTH(TODAY(),-2),TODAY()))


RETURN
IF(ISBLANK([Totals Per Cost Type (Resource)]),
DIVIDE(PriorMonthCost,NumDaysPrevPeriod),
Blank())

 

RemoveFilters is used so that the forecast is always based on current previous month and current month.

IF(ISBLANK is used so that the graph only shows the forecast for future dates.

 

In short, how can I make sure that my daily forecast will be summed up correctly when dilling down in the graph to a monthly level? 

 

Many thanks!

 

Kind regards,

Niels

 

 

1 ACCEPTED SOLUTION
NielsBakker
Frequent Visitor

Thanks for your response. 

 

In the mean time I found the solution that I needed. Needed to put a SUMX before the DIVIDE funtion. 

View solution in original post

2 REPLIES 2
NielsBakker
Frequent Visitor

Thanks for your response. 

 

In the mean time I found the solution that I needed. Needed to put a SUMX before the DIVIDE funtion. 

Anonymous
Not applicable

Hi @NielsBakker ,

For the information you provided, I don't think I can do the .pbix file recovery, if you can provide me more images, information or .pbix files, I can do a more in-depth research.
But I noticed that your DAX code utilizes the REMOVEFILTERS function, so I think you can change it to ALLSELECTED function or ISFILTERED function, the following is the documentation about the two functions, you can read it: ALLSELECTED function (DAX) - DAX | Microsoft Learn and ISFILTERED function (DAX) - DAX | Microsoft Learn

 

 

 

Best Regards

Yilong Zhou

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

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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