cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AshDil
Helper V
Helper V

Want to show Previous quarter Sales

Hi,

 

Now we are in 2022 Q1, I need to show previous quarter (2021 Q4) Sales. Like wise when we moved to 2022 Q2, need to show 2022 Q1 Sales......

I tried using following measures

Measure = calculate(Sum('Table'[sales]),Dateadd('Calendar'[Date],-1,Quarter))

and also with 

Measure = calculate(Sum('Table'[sales]), Previousquarter('Calendar'[Date]))

But unable to show 2021 Q4 sales.

Please help me to do it.

Thanks,

AshDil.

1 ACCEPTED SOLUTION

Hi @visheshjain ,

 

I have created Calendar table using CalendarAuto(), so it is having all the dates that contained in source tables. I have checked max date in Calendar table, which is 31 Dec 2022. 

So I have used following measure, it worked.

Measure =
CALCULATE (
SUM ( 'Table'[Sales] ),
FILTER (
'Calendar',
'Calendar'[Date]
IN DATESINPERIOD ( 'Calendar'[Date], EOMONTH ( TODAY (), -1 ), -1, QUARTER )
)
)
Thanks,

AshDil.

 

View solution in original post

3 REPLIES 3
Ailsa-msft
Community Support
Community Support

Hi @AshDil 

I am so glad to hear that you have solved your issue, please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regard

Community Support Team _ Ailsa Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

visheshjain
Resolver II
Resolver II

Hi @AshDil ,

 

Please can you make sure that your calendar table is 'Marked as Date Table'.
Also, that the date table contains the dates that you are tying to do the calculation on.

 

Your measures look alright, so this is the only thing that I can think of as of now.

 

Hope this helps.

 

Thank you,

Vishesh Jain

Hi @visheshjain ,

 

I have created Calendar table using CalendarAuto(), so it is having all the dates that contained in source tables. I have checked max date in Calendar table, which is 31 Dec 2022. 

So I have used following measure, it worked.

Measure =
CALCULATE (
SUM ( 'Table'[Sales] ),
FILTER (
'Calendar',
'Calendar'[Date]
IN DATESINPERIOD ( 'Calendar'[Date], EOMONTH ( TODAY (), -1 ), -1, QUARTER )
)
)
Thanks,

AshDil.

 

Helpful resources

Announcements
August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors