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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
jakob82
Frequent Visitor

Question regarding filter on CALCULATE PREVIOUSDAY and DATESYTD

Hi

 

I have a measure like this: 

 

Amount Previous Day:=CALCULATE([Amount], PREVIOUSDAY('Dim Date'[Balance Date]), DATESYTD('Dim Date'[Balance Date]))

 

and it works like i expected. But when I read about CALCULATE I don't get exactly why it is working..

 

 When i filter on period August, in the report, it still shows the previous day Amount for 1 of August, which is Amount for july 31. I thought the context was modified when I filter on August and therfore should not be a previous day amount? Why is it working like this?

 

jakob82_0-1696669868848.png

 

1 ACCEPTED SOLUTION
Dangar332
Super User
Super User

hi, @jakob82 


you use  DATESYTD('Dim Date'[Balance Date]) function which give you dates of year which you currently itrrated. means if you current date is 2023-08-01 then it give you date from (2023-01-01) to (2023-08-01)

so your calculate filter expression filter date from (2023-01-01) to (2023-08-01).

 

use DATESMTD('Dim Date'[Balance Date]) which give you date only currently ittarated month

means your current date = 2023-08-10 then   DATESMTD('Dim Date'[Balance Date]) give you (2023-08-01) to (2023-08-10)

Amount Previous Day:=CALCULATE([Amount], PREVIOUSDAY('Dim Date'[Balance Date]), DATESMTD('Dim Date'[Balance Date]))

 

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

View solution in original post

2 REPLIES 2
Dangar332
Super User
Super User

hi, @jakob82 


you use  DATESYTD('Dim Date'[Balance Date]) function which give you dates of year which you currently itrrated. means if you current date is 2023-08-01 then it give you date from (2023-01-01) to (2023-08-01)

so your calculate filter expression filter date from (2023-01-01) to (2023-08-01).

 

use DATESMTD('Dim Date'[Balance Date]) which give you date only currently ittarated month

means your current date = 2023-08-10 then   DATESMTD('Dim Date'[Balance Date]) give you (2023-08-01) to (2023-08-10)

Amount Previous Day:=CALCULATE([Amount], PREVIOUSDAY('Dim Date'[Balance Date]), DATESMTD('Dim Date'[Balance Date]))

 

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

hi , @jakob82 

is there your solution

 

Helpful resources

Announcements
Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors