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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
ton-v
Frequent Visitor

MTD based on week number problems

Hello everyone,

 

juste before i stard, i searched before i post this and i could not find the same problem as me.

 

i am comparing each week the evolution of the turnover, and then i compare it to the budget. 

 

Also i compare the actual MTD values.

my expression:

 

MTD:=CALCULATE([sales];DATESMTD(Sales[Date]))

 

It is working fine alone, but when i am comparing by week it's not working well because some weeks on based on two different month. My formula should take the last date of previous month when there is two month in a same week.

 

Exemple :

example.PNG

 

You can see on my example that for the week 4, the mtd value is for march but it should be februar.

 

I need a mtd value where it always take the last day of previous month when there are two different month in a week.

 

I hope you can help me.

 

Thank you in advance

 

 

 

 

1 ACCEPTED SOLUTION

Hello,

 

No it doesn't work ufortunately.

 

Hopefully i resolved my problems by myself Here is the solution if people have the same issue.

 

(1)calculate the first day of the week using the function "FIRSTDATE"

 

(2)Then you calcultate the last day of the week  (1) + 6 

 

(3) You use a if function to now if the month number of 1 and 2 are equal, if month are equal you can use the calculated lastday (2), if not you have to find the lastday of month (1) with this formula DATE(YEAR((1));MONTH((1)+1;1)-1.

 

Finally you calculate the expression and for the filter you take datesbetween( firstdate(1);Lastdate(3)

View solution in original post

2 REPLIES 2
v-jayw-msft
Community Support
Community Support

Hi @ton-v ,

 

How about using FILTER() function and MonthNo to filter out specified month?

 

Best Regards,

Jay

Community Support Team _ Jay Wang

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

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

Hello,

 

No it doesn't work ufortunately.

 

Hopefully i resolved my problems by myself Here is the solution if people have the same issue.

 

(1)calculate the first day of the week using the function "FIRSTDATE"

 

(2)Then you calcultate the last day of the week  (1) + 6 

 

(3) You use a if function to now if the month number of 1 and 2 are equal, if month are equal you can use the calculated lastday (2), if not you have to find the lastday of month (1) with this formula DATE(YEAR((1));MONTH((1)+1;1)-1.

 

Finally you calculate the expression and for the filter you take datesbetween( firstdate(1);Lastdate(3)

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.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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