Forum Discussion
edson_souza
8 years agoRegular Visitor
DAX Formula Accumulate only the current month
I have historical values and need a measure to accumulate values only for the current month dynamically via DAX. How do I do? I have: Date Value 19/09/2018 300,00 20/09/2018 781,00 21/09/2018...
- 8 years ago
Hi, Anonymous and v-yulgu-msft.
I solved by mingling your help.
1) I created the calendar;
2) I created a measure to load only values of the current month:Value Current Month = CALCULATE( SUM('Fact'[Value]); FILTER('Calendar';MONTH('Calendar'[Dates]) = MONTH(TODAY())); FILTER('Calendar';YEAR('Calendar'[Dates]) = YEAR(TODAY())) )3) And then I used DATESMTD in the created measure:
Value Current month MTD = CALCULATE( [Value Current Month]; DATESMTD(Calendar[Dates]) )Thank you very much.
edson_souza
8 years agoRegular Visitor
Hi, Anonymous and v-yulgu-msft.
I solved by mingling your help.
1) I created the calendar;
2) I created a measure to load only values of the current month:
Value Current Month =
CALCULATE(
SUM('Fact'[Value]);
FILTER('Calendar';MONTH('Calendar'[Dates]) = MONTH(TODAY()));
FILTER('Calendar';YEAR('Calendar'[Dates]) = YEAR(TODAY()))
)3) And then I used DATESMTD in the created measure:
Value Current month MTD =
CALCULATE(
[Value Current Month];
DATESMTD(Calendar[Dates])
)
Thank you very much.