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
Karthik12
Helper V
Helper V

Filter with start date and MTD less than today

Hello Team,

I am trying to create a measure, which filters a sum from 27.12.2022 to < today (i,e) 26.01.2023. Start date is constant but End date should auto update daily to < today. 

 

My measure as follows

 

Test MTD sum = CALCULATE(SUM('mis monthly_plan'[plan]),FILTER('mis monthly_plan','mis monthly_plan'[date]>DATE(2023,1,1)&&'mis monthly_plan'[date]<DATESMTD(CALENDAR(TODAY())
 
But there was an error. Can you support for correction?
 
1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @Karthik12 

 

You can try the following methods.

Test MTD sum =
CALCULATE (
    SUM ( 'mis monthly_plan'[plan] ),
    FILTER (
        'mis monthly_plan',
        'mis monthly_plan'[date] > DATE ( 2023, 1, 1 )
            && 'mis monthly_plan'[date] < TODAY ()
    )
)

 

Best Regards,

Community Support Team _Charlotte

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

View solution in original post

3 REPLIES 3
v-zhangti
Community Support
Community Support

Hi, @Karthik12 

 

You can try the following methods.

Test MTD sum =
CALCULATE (
    SUM ( 'mis monthly_plan'[plan] ),
    FILTER (
        'mis monthly_plan',
        'mis monthly_plan'[date] > DATE ( 2023, 1, 1 )
            && 'mis monthly_plan'[date] < TODAY ()
    )
)

 

Best Regards,

Community Support Team _Charlotte

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

TomMartens
Super User
Super User

Hey @Karthik12 ,

 

I recommend reading this article as it contains almost everything about date/datetime calculations: Time patterns – DAX Patterns
I also recommend using a dedicated calendar table, how to create this table and why it's considered a best practice is also explained in the article.

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

@TomMartens Thanks. I go through the topics. It quite useful to me for further learning.

Still, am searching for the best solution to my problem. 

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.