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

use a "between" slicer to show records that have a total within the selected range

I have a matrix table of individuals showing donations given annually with a grand total for each individual. The data in the table shows the individual in rows and each year in columns. 

 

I would like have a "between" slicer to show records where the grand total falls into the selected range.  For example, if the slicer range is $5000-$10000, I would like the table to be filtered to only show individuals whose total giving is between $5000-$10000.

 

Is it possible to accomplish this using a slicer?

1 ACCEPTED SOLUTION

See if this works. 

Create a table to use as the slicer with the "New Parameter" option under Modeling in the ribbon. Enter the range of values:

What if.jpg

Once the slicer is added to the page, change the input to "Between" in the slicer's dropdown options

Inked2022-03-30_LI.jpg

I have the model set up like this. I will use the fields from the dimension tables in the matrix and the measure need to filter the matrix 

model.jpg

 

The values in the Matrix are a simple SUM measure. To filter the rows based on the range in the slicer, create the following measure:

 

 

Filter by Range =
VAR MinSelected =
    MIN ( 'Range of donations'[Range of donations] )
VAR MaxSelected =
    MAX ( 'Range of donations'[Range of donations] )
RETURN
    COUNTROWS (
        CALCULATETABLE (
            VALUES ( 'Name Table'[Name] ),
            FILTER (
                'Name Table',
                [Sum Donations] >= MinSelected
                    && [Sum Donations] <= MaxSelected
            )
        )
    )

 

 

Select the matrix and add this [Filter by Range] measure to the filter pane. Set the value to = 1

filter pane.jpg

 and you get

donations.gif

 

I've attached the sample PBIX file

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

7 REPLIES 7
PaulDBrown
Community Champion
Community Champion

Is that the actual structure of your data? Do you need the slicer to be dynamic (users can select a range of values from say 100 to 10,000) or just the two ranges you posted?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






not the actual structure.. the individual gifts are summed up in the table by year.  I could use a  data source that has the annual gifts already calculated in a field if needed.  I want the slicer to allow any range to be selected and the data filter accordingly. 

So you have a table with 3 columns: Name, year and donation?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






sure, go with that.  thanks so much for your help!

PaulDBrown
Community Champion
Community Champion

Sure. Any chance you can post some sample mock data to work on?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Name201720182019202020212022Total
Joe500 300   800
Jack100010003000 1500 6500
Sam   50 50100
Bob    5000 5000
Bill 5050100100 300
Mike   2500 5003000
Susan 10001000 100030006000
Stephanie 4005050100100700

rows in blue would show when the selected slicer range is $500-$1,000

rows in cyan would show when the selected slicer range is $5,000 - $10,000

See if this works. 

Create a table to use as the slicer with the "New Parameter" option under Modeling in the ribbon. Enter the range of values:

What if.jpg

Once the slicer is added to the page, change the input to "Between" in the slicer's dropdown options

Inked2022-03-30_LI.jpg

I have the model set up like this. I will use the fields from the dimension tables in the matrix and the measure need to filter the matrix 

model.jpg

 

The values in the Matrix are a simple SUM measure. To filter the rows based on the range in the slicer, create the following measure:

 

 

Filter by Range =
VAR MinSelected =
    MIN ( 'Range of donations'[Range of donations] )
VAR MaxSelected =
    MAX ( 'Range of donations'[Range of donations] )
RETURN
    COUNTROWS (
        CALCULATETABLE (
            VALUES ( 'Name Table'[Name] ),
            FILTER (
                'Name Table',
                [Sum Donations] >= MinSelected
                    && [Sum Donations] <= MaxSelected
            )
        )
    )

 

 

Select the matrix and add this [Filter by Range] measure to the filter pane. Set the value to = 1

filter pane.jpg

 and you get

donations.gif

 

I've attached the sample PBIX file

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






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.