Forum Discussion
What am i doing wrong
- 3 years ago
Hi cristianj, your calculation looks to be overcomplicated... Is there a spicific reason why you wrote it in this way? You can achieve the similar result much simplier:
Sales 7 days before = VAR _CurrentDate = SELECTEDVALUE( CalendarTable[Date] ) //we need to remember the currently selected date, because we0ll overwrite it with Calculate() later RETURN CALCULATE( SUM( Sales[Sales] ), CalendarTable[Date] = _CurrentDate - 7 )Let me know if it works or if I misunderstood your question.
Hi cristianj, your calculation looks to be overcomplicated... Is there a spicific reason why you wrote it in this way? You can achieve the similar result much simplier:
Sales 7 days before =
VAR _CurrentDate = SELECTEDVALUE( CalendarTable[Date] ) //we need to remember the currently selected date, because we0ll overwrite it with Calculate() later
RETURN
CALCULATE(
SUM( Sales[Sales] ),
CalendarTable[Date] = _CurrentDate - 7
)
Let me know if it works or if I misunderstood your question.
Thank you werry much, with your help i change the formula and now it is working
- Sergii243 years agoSuper User
I believe there is something related to Context Transition - Understanding context transition in DAX - SQLBI. Unfortunately I can't dedicate more time to debug your code but you can do so by yourself after carefully reading this article 🙂