Forum Discussion
wollensack
3 years agoFrequent Visitor
Measure to Count Records from Previous Month
Hello All, I am trying to calculate the total records from the previous month. I looked into a similar solution to my needs, but it did not help https://community.powerbi.com/t5/Desktop/Create-...
Anonymous
3 years agoNot applicable
Hello,
Please try using this format,
Prev Month Count=CALCULATE( COUNT('Table'[Column]), DATESYTD('Table'[Date]) = DATEADD(DATESYTD('Table'[Date]), -1, MONTH), SAMEPERIODLASTYEAR('Table'[Date]) )
Thanks,
wollensack
3 years agoFrequent Visitor
Hello Sanika,
thankyou for replying to my message
I assumed your solution is only looking at the one table "Table1"
I tried your solution and got an error
Prev Month Count = CALCULATE( COUNT('Table1'[Order_Nbr]), DATESYTD('Table1'[Date]) = DATEADD(DATESYTD('Table1'[Date]), -1, MONTH), SAMEPERIODLASTYEAR('Table1'[Date]) )
Error = "A function 'DATESYTD' has been used in a True/False expression that is used as a table filter expression. This is not allowed."
Error = "A function 'DATESYTD' has been used in a True/False expression that is used as a table filter expression. This is not allowed."