Forum Discussion
Blackworms
9 years agoFrequent Visitor
Individual Visual Filtering & MoM Comparison
Hi everyone, First of, thanks for all the help on the forums; however, I have a problem which I couldn't resolve at all since I am kind of beginner with DAX. My dataset has unique Sales Year-...
- 9 years ago
Hi Blackworms,
You should calculate this year sales use DATESMTD function.This Year Sales = CALCULATE(SUM([SalesRevenue]);DATESMTD('Calendar'[Date].[Date]))
As I tested, I create a relationship between Calendar and Sales table, and create two measure usingthe following formulas, it works fine.This Year Sales = TOTALMTD(SUM(Sales[SALE]),'Calendar'[DATE])
Last Year Sales = VAR DataMaxDate = CALCULATE ( MAX('Calendar'[Date] ), ALL ('Calendar'[Date]) ) RETURN CALCULATE ( [This Year Sales], SAMEPERIODLASTYEAR ( INTERSECT ( VALUES ( 'Calendar'[Date]), DATESBETWEEN ( 'Calendar'[Date],BLANK (), DataMaxDate ) ) ) )Please see the following screenshot, when I select particular month, it still shows correctly.
Thanks,
Angelia
v-huizhn-msft
9 years agoMicrosoft Employee
Hi Blackworms,
Your issue has been resolved? If not, please post the feedback. If you have, please mark the right reply as answer.
Thanks,
Angelia