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
elie_abidaher
Helper I
Helper I

Calculate sales period based on current month

Hi

I am new in Power BI and i received a somewhat complex requirment 🙂 which i don't know how to handle

I want to calculate and display a sales period for the past n years, for example if Now month is Nov 2019 and n=3 then i want to display in a table

 

n     Sales Period

1     Nov 1 2018 - Nov 30 2019

2     Nov 1 2017 - Nov 30 2018

3     Nov 1 2016 - Nov 30 2017

1 ACCEPTED SOLUTION

@elie_abidaher solution attached, everything is done in power query. a function takes two parameters and make it happen. Feel free to change as per your need.

 

Would appreciate Kudos 🙂 if my solution helped.



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

8 REPLIES 8
Ashish_Mathur
Super User
Super User

Hi,

Please refer to my Blog article - Flex a Pivot Table to show data for x months ended a certain user defined month.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
parry2k
Super User
Super User

@elie_abidaher how many n periods you want to show? Does it always take current month as the month to do calculations?



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.

Hi @parry2k

The maximum n is 10 and it will always take the current month for calculations

@elie_abidaher solution attached, everything is done in power query. a function takes two parameters and make it happen. Feel free to change as per your need.

 

Would appreciate Kudos 🙂 if my solution helped.



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.

hi @parry2k 

 

now i have a table with all my specified date ranges, how can create a link between your table and my table, in the sense that i want to create a column in my table and call it Period, that column will be populated with the proper period value from your table, after checking the Date column in my table

Hi
Thank you for your quick help, I will check the attached and update you

Hi elie_abidaher, 

You could refer to above suggestions to see whether it work or not. If this is not what you want, please inform me more detailed information (such as your sample data and your expected output), then I will help you more correctly.

Best Regards,
Zoe Zhi

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

Hi

unfortunately, i cannot post any kind of data here, but to summarize, i have two tables one containing vehicle information and the other containing service history logs

what i was asked to do is, based on the number of years i want to display how many vehicles were sold in every period, total distinct number of vehicle that came for servicing in that year, then i want to split that total and display the count for each sales period

so the outout will be

 

n           SalesPeriod          TotalVehiclesSold            CameForService

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.