Forum Discussion
Power BI Desktop Direct Query What-If Analysis
- 9 years ago
I've finally stumbled across a solution that appears to be working for me nicely.
For anyone else running across a similar issue, I created two measures: one to calculate the max date within the data, and another to calculate the L2W sales.
MaxDate = CALCULATE(MAX(dataset[date]), ALLSELECTED(dataset))
Then I take the MaxWeekEndingDate and use it the L2W calculation.
L2W Sales = CALCULATE(SUM(dataset[Sales]),
FILTER( ALLSELECTED(dataset[date]), dataset[date] >= (DATE(
YEAR([MaxDate]),
MONTH([MaxDate]),
DAY([MaxDate])
) - 14)
) )The above measures will produce the "Desired Dataset" in my original question.
And here's the post that gave me the final piece of information I needed to solve it. https://community.powerbi.com/t5/Desktop/dateadd-and-max-error/td-p/124932
I've finally stumbled across a solution that appears to be working for me nicely.
For anyone else running across a similar issue, I created two measures: one to calculate the max date within the data, and another to calculate the L2W sales.
MaxDate = CALCULATE(MAX(dataset[date]), ALLSELECTED(dataset))
Then I take the MaxWeekEndingDate and use it the L2W calculation.
L2W Sales = CALCULATE(SUM(dataset[Sales]),
FILTER( ALLSELECTED(dataset[date]), dataset[date] >= (DATE(
YEAR([MaxDate]),
MONTH([MaxDate]),
DAY([MaxDate])
) - 14)
) )
The above measures will produce the "Desired Dataset" in my original question.
And here's the post that gave me the final piece of information I needed to solve it. https://community.powerbi.com/t5/Desktop/dateadd-and-max-error/td-p/124932
- Anonymous9 years agoNot applicable
Nathan,
Glad to hear the issue is solved. You can accept your reply as solution, this way, other community members could easily find the solution when they get same issues.
Regards,