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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
hainguyen28
New Member

Showing sales data in the previous N month (N is input from user)

I currently have a graph that display sales within the previous 13 months. The user can choose the year and month, and the graph would show sales in the 13 months prior (including the month of their choice). Below is the screenshot:

sales in the last 13 months.png

 

Here is the measure I created for the Total sales - Last 13 months:

thumbnail_image002.png

 

Right now, I am being asked to adjust the graph, adding another filter called "Number of months", where user can select a number between 3 and 15. For example, if the user chooses 3, then the graph will display sales in the previous 3 months. If the user chooses 10, then the graph will show sales in the previous 10 months. Does anyone have an idea how I can do this?

1 ACCEPTED SOLUTION
Uzi2019
Super User
Super User

Hi @hainguyen28 

 

yes. you can simply create number parameter .

Uzi2019_0-1737010048471.png

 

then adjust you range accordingly.

Uzi2019_1-1737010088467.png

 

 

Then 

change your measure where you have put 13 month 

 

use selectedvalue([Month parameter]))

so it will take your input instead of 13 it will take user input.

make sure put negative (-) sign with selectedvalue([Month parameter]))

 

I hope I answered your question!

 

 

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

View solution in original post

2 REPLIES 2
Uzi2019
Super User
Super User

Hi @hainguyen28 

 

yes. you can simply create number parameter .

Uzi2019_0-1737010048471.png

 

then adjust you range accordingly.

Uzi2019_1-1737010088467.png

 

 

Then 

change your measure where you have put 13 month 

 

use selectedvalue([Month parameter]))

so it will take your input instead of 13 it will take user input.

make sure put negative (-) sign with selectedvalue([Month parameter]))

 

I hope I answered your question!

 

 

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Thank you. This is exactly what I was looking for. I was able to add the parameter and adjust my measure accordingly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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