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
UmangPaliwal
Frequent Visitor

Calculate last month sales & last year sales without having any date context

Hello all,
I've a dataset which gets monthly sales data for entities A,B & C. Data is not regular and comes consolidated only after few months so currently we have data up to June-22. Objective is to show Sales for Latest Month, Last Month & Same Month Last year from dataset.
something like this

UmangPaliwal_0-1663605581722.png

Now i'm able to calculate latest sales i.e for June-22 using a measure with max filter on date column.
however i'm not sure how to do this for previous month and also same month last year. it also needs to be taken into consideration for when year will change. there are to be no date filters on the report page.

Sample Data:-

UmangPaliwal_1-1663606125879.png

@amitchandak @parry2k  @Greg_Deckler 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your data model looks like, but I tried to create a sample pbx file like the attached.

Please check the attached file.

All measures are in the attached pbix file.

 

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

3 REPLIES 3
parry2k
Super User
Super User

@UmangPaliwal check these 2 videos on my YT channel and tweak it as you see fit

 

Learn how to compare MTD sales as of date with same number of days in previous months - Part 6 - You...

 

Learn how to compare MTD sales as of date with same number of days last year - Part 7 - YouTube

 

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort 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.

Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your data model looks like, but I tried to create a sample pbx file like the attached.

Please check the attached file.

All measures are in the attached pbix file.

 

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Thank you. this works just fine

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.