cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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?

1 ACCEPTED SOLUTION
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

2 REPLIES 2
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

Super User

hi , @jakob82

Announcements

New forum boards available in Real-Time Intelligence.

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

Power BI Monthly Update - May 2024

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

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors