Forum Discussion
Mith
3 years agoRegular Visitor
Current Month vs Previous Month
Hi, I was using the below Dax formula for current month and previous month month last 9 months and giving me the accurate answer. Today i noticed after refreshed the data, in my report for CM and...
- 3 years ago
This should work now.
Current month Female = VAR _current_month = MONTH ( EOMONTH ( TODAY (), -1 ) ) VAR _current_year = Year ( EOMONTH ( TODAY (), -1 ) ) RETURN CALCULATE ( [Female_App], FILTER ( Applicant, INT(MONTH ( Applicant[Added Date] )) = INT(_current_month) && INT(YEAR ( Applicant[Added Date] )) = INT(_current_year) ) )previous month Female = VAR _current_month = MONTH ( EOMONTH ( TODAY (), -2 ) ) VAR _current_year = Year ( EOMONTH ( TODAY (), -2 ) ) RETURN CALCULATE ( [Female_App], FILTER ( Applicant, INT(MONTH ( Applicant[Added Date] )) = INT(_current_month) && INT(YEAR ( Applicant[Added Date] )) = INT(_current_year) ) )
Samarth_18
Community Champion
3 years agoMith Whats the Error?
One more thing Current month you means Jan and previous month Dec?
Mith
3 years agoRegular Visitor
Getting the same error. I wanted to show Dec as a current month and november as previous month data. applicant added date is up to 12/31/2022.
- Samarth_183 years ago
Community Champion
This should work now.
Current month Female = VAR _current_month = MONTH ( EOMONTH ( TODAY (), -1 ) ) VAR _current_year = Year ( EOMONTH ( TODAY (), -1 ) ) RETURN CALCULATE ( [Female_App], FILTER ( Applicant, INT(MONTH ( Applicant[Added Date] )) = INT(_current_month) && INT(YEAR ( Applicant[Added Date] )) = INT(_current_year) ) )previous month Female = VAR _current_month = MONTH ( EOMONTH ( TODAY (), -2 ) ) VAR _current_year = Year ( EOMONTH ( TODAY (), -2 ) ) RETURN CALCULATE ( [Female_App], FILTER ( Applicant, INT(MONTH ( Applicant[Added Date] )) = INT(_current_month) && INT(YEAR ( Applicant[Added Date] )) = INT(_current_year) ) )- Mith3 years agoRegular Visitor
thanks you now this dax works for me.
thank you so much for your help.