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
Anonymous
Not applicable

MTD CALCULATIONS FOR LAST 5 MONTHS

Hello Guys,

 

Hope you are well,

I have one problem,

I have to calculate MTD for last 5 months like right now we have in Aug21 so last 5 months would be Aug21,July21,Jun21,May21,Apr21 

and today is 4th Aug21 

Hence Last 5 months MTD would be

MTD Aug21= 1-4th Aug

MTD July21 = 1-4th July

MTD Jun21=1-4th June

MTD May21=1-4th May

MTD Apr=1-4th Apr

and it will based on today date.

Please help me on this please.

Thanks

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi,

I am trying this but out is showing blank

Pre_Month-2 = CALCULATE(TOTALMTD([Sec_Vol],'db_CSA_Data Yield_Sec_Test'[InvoiceDate],PARALLELPERIOD('db_CSA_Data Yield_Sec_Test'[InvoiceDate],-3,MONTH)))
 
[Sec_vol]- it is already in sum
 
Please help me on this

View solution in original post

Anonymous
Not applicable

Got it by my own logic,

 

prev month MTD Vol = CALCULATE(SUM('VIT-IK SAP_Secondary_data'[Volume]),FILTER('VIT-IK SAP_Secondary_data',DAY('VIT-IK SAP_Secondary_data'[InvoiceDate])>=1 && DAY('VIT-IK SAP_Secondary_data'[InvoiceDate])<=DAY(MAX('VIT-IK SAP_Secondary_data'[InvoiceDate]))),FILTER('VIT-IK SAP_Secondary_data',(YEAR('VIT-IK SAP_Secondary_data'[InvoiceDate])=YEAR(MAX('VIT-IK SAP_Secondary_data'[InvoiceDate]))&&MONTH('VIT-IK SAP_Secondary_data'[InvoiceDate])=MONTH(MAX('VIT-IK SAP_Secondary_data'[InvoiceDate]))-1)))
 
It is giving me 1-4th July 21 vol=758 that is correct

View solution in original post

7 REPLIES 7
Tanushree_Kapse
Impactful Individual
Impactful Individual

Hi @Anonymous ,

 

Try:
Measure=
CALCULATE(TOTALMTD(SUM(Total Sales),Table[Date]), PARALLELPERIOD(Table[Date], -4, MONTH))

 

I hope this helps!

Thanks.

Anonymous
Not applicable

Hi,

Thanks for your great help,

One more help please as MTD for current is showing correct number but while previous month it is showing full month data.

for Example today is 5th aug then MTD is 1-5th aug sales data similarly for previous month mtd it should 1-5th July of total sales 

please help on this thanks.

Hi @Anonymous 

 

Try this measure:

Prev MTD = CALCULATE([Sec_vol], PREVIOUSMONTH(DATESMTD(db_CSA_Data Yield_Sec_Test'[InvoiceDate])))

 

I hope this helps!

 

If this answers your question, please mark it as a solution.  Kudos are always appreciated.

Thanks!

Anonymous
Not applicable

This dax giving me full month sales instead of 1-5th Jul21.

 

Anonymous
Not applicable

output should be 758 for 1-4th July 21.

shankarshiva70_0-1628173627266.png

 

Anonymous
Not applicable

Got it by my own logic,

 

prev month MTD Vol = CALCULATE(SUM('VIT-IK SAP_Secondary_data'[Volume]),FILTER('VIT-IK SAP_Secondary_data',DAY('VIT-IK SAP_Secondary_data'[InvoiceDate])>=1 && DAY('VIT-IK SAP_Secondary_data'[InvoiceDate])<=DAY(MAX('VIT-IK SAP_Secondary_data'[InvoiceDate]))),FILTER('VIT-IK SAP_Secondary_data',(YEAR('VIT-IK SAP_Secondary_data'[InvoiceDate])=YEAR(MAX('VIT-IK SAP_Secondary_data'[InvoiceDate]))&&MONTH('VIT-IK SAP_Secondary_data'[InvoiceDate])=MONTH(MAX('VIT-IK SAP_Secondary_data'[InvoiceDate]))-1)))
 
It is giving me 1-4th July 21 vol=758 that is correct
Anonymous
Not applicable

Hi,

I am trying this but out is showing blank

Pre_Month-2 = CALCULATE(TOTALMTD([Sec_Vol],'db_CSA_Data Yield_Sec_Test'[InvoiceDate],PARALLELPERIOD('db_CSA_Data Yield_Sec_Test'[InvoiceDate],-3,MONTH)))
 
[Sec_vol]- it is already in sum
 
Please help me on this

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

Top Solution Authors