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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
v-yetao1-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
Solution Supplier
Solution Supplier

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

Did I answer your question?
If yes, then please mark my post as a solution!

Thank you,
Vishesh Jain

Proud to be a Super User!



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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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