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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
likhithar
Helper III
Helper III

Last Month MTD till selected Date

Hello All,

I'm showing Sales MTD and Last Month Sales MTD week wise trend,for Last Month Sales MTD i'm having full data for last month and in current month my data is till 16.There,for Last Month Sales MTD the value is showing till month end instead of current month last date.There is no interaction between day and wise wise trend graph.

In the below picture,When I put Day with week Sales LM MTD is 2,058 but the total  is 4,304 which is last full month sales instead of till 16.If I remove day and week as dimension ,week 3 Sales LM MTD is showing as 4,304 .It has to be 2,058.

DAX which I used is 

Sales MTD_1 = 
CALCULATE (
[Sales Amount],
FILTER(
     ALLSELECTED(dim_Date) ,
dim_Date[PeriodDate] <= MAX( dim_Date[PeriodDate] )
)
)/100000
Sales MTD = CALCULATE([Sales Amount],DATESMTD(dim_Date[PeriodDate]),ALL(dim_Date))/100000
Sales LM MTD = CALCULATE([Sales MTD],ALL(dim_date),DATEADD(dim_date[perioddate],-1,MONTH))
Sales LM MTD_1 = CALCULATE(CALCULATE([Sales Amount],DATEADD(dim_date[perioddate],-1,MONTH))/100000,FILTER(ALLSELECTED(dim_Date),dim_Date[PeriodDate]<=MAX(dim_Date[PeriodDate])))

Week wise sales.PNGWeek Sales.PNGWeek Trend.PNG

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Does this measure help?

Sales LM MTD = CALCULATE([Sales MTD],datesbetween(dim_date[perioddate],edate(min(dim_date[perioddate]),-1),edate(max(dim_date[perioddate]),-1)))

This should work if the dim_date table goes only till today's date.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

3 REPLIES 3
likhithar
Helper III
Helper III

@Ashish_Mathur  Absolutely I worked Ashish..Thank you so much 🙂

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ashish_Mathur
Super User
Super User

Hi,

Does this measure help?

Sales LM MTD = CALCULATE([Sales MTD],datesbetween(dim_date[perioddate],edate(min(dim_date[perioddate]),-1),edate(max(dim_date[perioddate]),-1)))

This should work if the dim_date table goes only till today's date.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.