Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
kchan
Frequent 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 basic tutorial scenario using the Contoso Sales sample data but I still can't get previousquarter, previousmonth to work.  They just return blank.

 

When I use the parallelperiod method it works with Contoso data but with my data it just returns the same result as the context.  Eg. previous month is the same as the current month

 

I'm lost, anyone else encounter this issue?

 

Thanks!

 

 

 

 

 

1 ACCEPTED SOLUTION
v-haibl-msft
Microsoft Employee
Microsoft Employee

@kchan

 

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] ) )

Time Intelligence Functions - Help_1.jpg

 

Best Regards,

Herbert

 

View solution in original post

2 REPLIES 2
v-haibl-msft
Microsoft Employee
Microsoft Employee

@kchan

 

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] ) )

Time Intelligence Functions - Help_1.jpg

 

Best Regards,

Herbert

 

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.  

 

 

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

Check out the April 2025 Power BI update to learn about new features.

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

Find out what's new and trending in the Fabric community.