Forum Discussion
Creating DAX measures for current and previous calendar month
Hi Anonymous ,
If you only want to calculate the counts of "current month", "last month", "last before month " by using the Dax, you could try the formula below.
Claims Last Month =
VAR current_month =
MONTH ( TODAY () )
RETURN
CALCULATE (
DISTINCTCOUNT ( 'DataMart'[Invoice Id] ),
FILTER (
'DataMart',
'DataMart'[Invoice Status] = "SUBMITTED"
&& MONTH ( 'DataMart'[Invoice Date] ) = current_month - 1
)
)Claims Last Before Month =
VAR current_month =
MONTH ( TODAY () )
RETURN
CALCULATE (
DISTINCTCOUNT ( 'DataMart'[Invoice Id] ),
FILTER (
'DataMart',
'DataMart'[Invoice Status] = "SUBMITTED"
&& MONTH ( 'DataMart'[Invoice Date] ) = current_month - 2
)
)Best Regards,
Community Support Team _ Joey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous6 years agoNot applicable
I cannot see why this isn't working, I did try a VAR myself with no change to the total, what it's giving me is the grand total but not the total for the month in question. I add a minus two to the end of the measure, and the number doesn't change.
I have the month split in a matrix so I know what numbers I should be getting.
I can't upload a sample dataset to this forum as I don't have the option.
- v-joesh-msft6 years ago
Solution Sage
Hi Anonymous ,
You need to have a cloud storage such as Onedrive or Google Drive where you can put your file. After that, you create a shareable link that you can insert in your post enabling people to download the file.
Best Regards,
Community Support Team _ Joey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.