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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
palabi
Frequent Visitor

Select multiple items for filter in slicer

Hi! I have a table with the inventory of my products, and also the sales of each product.

In order to know how much inventory I have left before running out, I calculate how much inventory I have this week, and divide it by how many sales in average I had in the past.


So, the formula is:
Inventory / Average weekly sales

The result is a number that tells me how many weeks I still can sell without needing more inventory. If it is too low I have to get more product, if it is too high, I may consider a price drop.

 

This is my problem:

To calculate the average weekly sales, I use the sales of the last 4 to 20 weeks (the exact number depends on each product). This is no problem when I want to see my result of the current week. But if I need to checks last week´s, or any other week in the past, I have to select that week on the slicer, and manually select the other pasts weeks manually, this has created many trouble and many errors by humans.


What I need is some way to select in one click 4 to 20 weeks, prior to the week from where I need the result.

For example, I have weeks 1 to 20, I want to calculate the average using the last 4 weeks for each week. If I select “week15” on a slicer, I need to also select week14, week13, week12 and week11. Or if I select “week10” the filter should also include “week9, week8, week7 and week6”.


Any help or ideas on how to do this?

Thanks very much

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi,@palabi

you may try to add a measure to calculate the average using the last 4 weeks for each week like as below:

Last 4 weeks AVERAGE = 
VAR currWeek =
    MAX ( StoreSales[Week id] )
RETURN
    CALCULATE (
        AVERAGE(StoreSales[Qty]),
        FILTER (
            ALL(  StoreSales ),
            StoreSales[Week id]
                IN GENERATESERIES ( MAX ( currWeek - 4, 1 ), currWeek-1, 1 )

Result:

2.PNG

after selecting one week 

3.PNG

Here is DEMO ,please try it

https://www.dropbox.com/s/qde8w728om35fcq/Select%20multiple%20items%20for%20filter%20in%20slicer.pbi...

 

Best Regards,

Lin

 

 

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

View solution in original post

2 REPLIES 2
v-lili6-msft
Community Support
Community Support

hi,@palabi

you may try to add a measure to calculate the average using the last 4 weeks for each week like as below:

Last 4 weeks AVERAGE = 
VAR currWeek =
    MAX ( StoreSales[Week id] )
RETURN
    CALCULATE (
        AVERAGE(StoreSales[Qty]),
        FILTER (
            ALL(  StoreSales ),
            StoreSales[Week id]
                IN GENERATESERIES ( MAX ( currWeek - 4, 1 ), currWeek-1, 1 )

Result:

2.PNG

after selecting one week 

3.PNG

Here is DEMO ,please try it

https://www.dropbox.com/s/qde8w728om35fcq/Select%20multiple%20items%20for%20filter%20in%20slicer.pbi...

 

Best Regards,

Lin

 

 

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

Thank you very much for your help.
I´m afraid I dont fully understand the solution, but it seems to work!
Let me have a couple of days to learn a little about the functions please.

 

thanks again!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.