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
kryo69
New Member

Last quarter measure issue.

This might be a simple but pardon me for asking this and if I have committed any silly mistakes. I am new to Power BI and Dax.

I have the sales data that has a lot of depth in terms of different product levels and sales territory levels(minimum 5 levels in both). For this clarification purpose I have simplified the data. 

 

RawData.PNG

So the data is huge. We look at the data at quarter level. We have customised quarter column like 2021-Q1,2021-Q2,2021-Q3,2021-Q4 etc.

 

QtrStartDate column shows the start date for respective quarter. 

QtrDate.PNG

 

I am trying to show a table where for each quarter, corresponding quarter sales and previous quarter sales should show side by side.

 

I used the following formula to get last qtr sales hoping it will calculate LQ sales but unforunately not working.

 

 

 

 

 

 

LQ_Sales = CALCULATE(SUM(Sales[Sales]),DATEADD(Sales[QtrStartDate],-3,MONTH))

 

 

 

 

 

 

 

Results.PNG

 

PowerBI file present in the the following location.

 

https://1drv.ms/u/s!Auk1Ju_9g1YgggKNtZGtXdrd1bPs?e=tlobGR 

 

Any help will be appreciated! Thank you in advance!

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@kryo69 you should add calendar dimension in your model, you can follow my blog post to add one Create a basic Date table in your data model for Time Intelligence calculations | PeryTUS IT Solutio... 

 

set relationship of this new dimension with your table add following two measures:

 

Sales = SUM ( Table[SAles] )

PQ Sales = CALCUALTE ( [SAles], PREVIOUSQUARTER ( Calendar[Date] ) )

 

To visualize, use quarter from calendar dimension and above two measures, and you will have your result.

 

Follow us on LinkedIn

 

Learn about conditional formatting at Microsoft Reactor

My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

2 REPLIES 2
parry2k
Super User
Super User

@kryo69 you should add calendar dimension in your model, you can follow my blog post to add one Create a basic Date table in your data model for Time Intelligence calculations | PeryTUS IT Solutio... 

 

set relationship of this new dimension with your table add following two measures:

 

Sales = SUM ( Table[SAles] )

PQ Sales = CALCUALTE ( [SAles], PREVIOUSQUARTER ( Calendar[Date] ) )

 

To visualize, use quarter from calendar dimension and above two measures, and you will have your result.

 

Follow us on LinkedIn

 

Learn about conditional formatting at Microsoft Reactor

My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k Thanks a lot😊

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.