Forum Discussion
kchan
10 years agoFrequent Visitor
Time Intelligence Functions - Help (PREVIOUSQUARTER, PREVIOUSMONTH, etc)
Hi All, I've been trying to get this working with my data with no success. I followed instructions found in the related posts but I keep coming up with a blank/wrong results. I tried the basi...
- 10 years ago
For the Contoso Sales sample, I used following two measures to get the sales amount of previous quarter/month. I’ve uploaded my Power BI file here. Please take a look at it to see if there is any difference with yours.
Sales_PreviousQuarter = CALCULATE ( SUM ( Sales[SalesAmount] ), PREVIOUSQUARTER ( 'Calendar'[DateKey] ) )Sales_PreviousMonth = CALCULATE ( SUM ( Sales[SalesAmount] ), PREVIOUSMONTH ( 'Calendar'[DateKey] ) )
Best Regards,
Herbert
v-haibl-msft
Microsoft Employee
10 years ago
For the Contoso Sales sample, I used following two measures to get the sales amount of previous quarter/month. I’ve uploaded my Power BI file here. Please take a look at it to see if there is any difference with yours.
Sales_PreviousQuarter =
CALCULATE (
SUM ( Sales[SalesAmount] ),
PREVIOUSQUARTER ( 'Calendar'[DateKey] )
)Sales_PreviousMonth = CALCULATE ( SUM ( Sales[SalesAmount] ), PREVIOUSMONTH ( 'Calendar'[DateKey] ) )
Best Regards,
Herbert
kchan
10 years agoFrequent Visitor
Thanks Herbert.
My formula wasn't wrong just the context of the date key was wrong. I kept using the full date and realized it once I saw your file.