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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
carnage66
Frequent Visitor

SUM values for current month but with projection for incomplete month

Hi all,

I have the following measures with the idea to calculate deviation between months:

 

CurrentMonth = CALCULATE(SUM('Transactions'[Volume]),
FILTER('Days', 'Days'[Month] = MAX('Days'[Month])))
 
PreviousMonth = CALCULATE(SUM('Transactions'[Volume]),
FILTER(ALL('Days'),'Days'[Month] = MAX('Days'[Month])-1))
 
Deviation = [ThisMonth]/[PreviousMonth]-1
 
However, the problem is that my current month is always incomplete. For example today is 18 April, so my deviation for April is always on negative % because it calculates incomplete month vs full previous month:
carnage66_1-1650294043852.png
Is there a way to update the measure for current month to include a projection for the full month. For example to divide the volume by 18 days and multiple by 30 (depending how long current month is) to create projection for the current month which will then be used for the projected deviation. 
 
Hope I explained it well enough. If you have some other idea, I'd appreciate it. 
 
Edit: I just noticed that Volume in March is not the same as PreviousMonth in April (very slight difference). Any idea why that might be?
2 REPLIES 2
amitchandak
Super User
Super User

@carnage66 , Try Datesmtd with date table

 

example

 

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))

 

 

or

 

MTD QTY forced=
var _max = today()
return
if(max('Date'[Date])<=_max, calculate(Sum('order'[Qty]),DATESMTD('Date'[Date])), blank())
//or
//calculate(Sum('order'[Qty]),DATESMTD('Date'[Date]),filter('Date','Date'[Date]<=_max))
//calculate(TOTALMTD(Sum('order'[Qty]),'Date'[Date]),filter('Date','Date'[Date]<=_max))


LMTD QTY forced=
var _max = date(year(today()),month(today())-1,day(today()))
return
if(max('Date'[Date])<=_max, CALCULATE(Sum('order'[Qty]),DATESMTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max), blank())
//OR
//CALCULATE(Sum('order'[Qty]),DATESMTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max)
//TOTALMTD(Sum('order'[Qty]),dateadd('Date'[Date],-1,year),'Date'[Date]<=_max)

 

Thanks, I will use these for previous month but unfortunately none of them help with the idea of a projection for the current month. The main idea is to create a measure where if the month is not complete, divides the sum by current date and multiplies it by the max days in the month, while for complete months shows just the sum. 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors