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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.