Skip to content

Instantly share code, notes, and snippets.

@aabundez
Last active November 22, 2019 16:22
Show Gist options
  • Save aabundez/57c693359ebe37a10077e79a9e1ed458 to your computer and use it in GitHub Desktop.
Save aabundez/57c693359ebe37a10077e79a9e1ed458 to your computer and use it in GitHub Desktop.
Calculate prior month sales without a Date table
Revenue PM =
var prior_month_start_date = EOMONTH( MIN ( Sales[Date] ), -2 ) + 1
var prior_month_end_date = EOMONTH( MIN ( Sales[Date] ), -1 ) + 1
RETURN
CALCULATE(
SUM ( Sales[Revenue] ),
FILTER (
ALLSELECTED ( Sales ),
Sales[Date] >= prior_month_start_date && Sales[Date] < prior_month_end_date
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment