Forum Discussion
DATE ADD Question/problem
- 6 years ago
It looks like you are using the Order Date column from your fact table i.e., not your Date table. When you add -1 day to the Date table with DATEADD() you are then returning a result for the day of the previous year (even though the Date table is filtered to the current year). If you use your 'Date Table'[Date] column in your visual you should take care of the issue.
If you need to keep the order date column in there for some reason, you can add another term to your CALCULATE, so that it is filtered down to the current year.
If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
Hi Anonymous ,
You can try this measure
Order Date Yesterday Orders =
VAR a =
MAX ( 'Orders 2'[Order Date] )
VAR previousdate =
CALCULATE (
MAX( 'Orders 2'[Order Date] ),
FILTER (
ALL ( 'Orders 2' ),
'Orders 2'[Order Date] < a
)
)
RETURN
CALCULATE (
SUM ( 'Orders 2'[Net Price] ),
FILTER (
ALL ( 'Orders 2' ),
'Orders 2'[Order Date] = previousdate
)
)
Regards,
Harsh Nathani
Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!