Skip to content

Instantly share code, notes, and snippets.

@Erik-H-zz
Created March 1, 2022 17:15
Show Gist options
  • Save Erik-H-zz/100d2469fe3a34d6c56dd980eb4f9c1d to your computer and use it in GitHub Desktop.
Save Erik-H-zz/100d2469fe3a34d6c56dd980eb4f9c1d to your computer and use it in GitHub Desktop.
Get the previous date of sales
Previous Date of Sales =
MAXX(
ADDCOLUMNS(
SUMMARIZE(
'FactInternetSales'
,'Product Name'[EnglishProductName]
,'FactInternetSales'[OrderDate]
)
,"@PreviousDate"
, CALCULATE(
MAX('FactInternetSales'[OrderDate])
,FILTER(
ALL('FactInternetSales'[OrderDate])
,'FactInternetSales'[OrderDate] < EARLIER('FactInternetSales'[OrderDate])
)
)
)
,[@PreviousDate]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment