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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
akina
New Member

What-if Parameters as Slicer and showing aggregated results

Hi,

 

I'm new to Power BI and I could say that the community is really great and full of talented Power BI experts.

 

I hope you could help me with this:

I want my slicer to be a one-box, numeric input type, in such a way that I could just enter a whole number, not range. And I know that What-if parameter could do that.

 

However, another thing I want is, given the example below where 'Age' is my filter (not AgeGroup since I don't want a dropdown), I would like my charts to show the aggregate value or summary of the age group based on the Age I input.

 

Example, if I input 51 in my What-if parameter slicer, instead of filtering my charts among 51 years old only, the charts would be filtered based on the corresponding age group of the age entered. So, if I enter 51 in my slicer, the resulting filter would be the whole '40-59 years old' including other ages which would give me 'Black' and 'White' as the favorite colors of my age group. 

 

AgeAgeGroupFaveColor
5140-59 years oldBlack
6060+ years oldBlack
3030-39 years oldBlue
5740-59 years oldBlue
7760+ years oldWhite
7260+ years oldWhite

 

Is this possible? Hope you could help me. Thanks a lot!

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @akina 

 

You can try the following methods.

Measure:

Measure =
SWITCH (
    TRUE (),
    SELECTEDVALUE ( 'Table'[AgeGroup] )
        = SWITCH (
            TRUE (),
            SELECTEDVALUE ( Parameter[Parameter] ) >= 30
                && SELECTEDVALUE ( Parameter[Parameter] ) <= 39, "30-39 years old",
            SELECTEDVALUE ( Parameter[Parameter] ) >= 40
                && SELECTEDVALUE ( Parameter[Parameter] ) <= 59, "40-59 years old",
            SELECTEDVALUE ( Parameter[Parameter] ) >= 60, "60+ years old"
        ), 1,
    BLANK ()
)

Put Measure in the Filter of the view and set it equal to 1.

vzhangti_0-1649039342017.png

The results are shown in the figure.

vzhangti_1-1649039404435.pngvzhangti_2-1649039419420.png

 

Best Regards,

Community Support Team _Charlotte

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-zhangti
Community Support
Community Support

Hi, @akina 

 

You can try the following methods.

Measure:

Measure =
SWITCH (
    TRUE (),
    SELECTEDVALUE ( 'Table'[AgeGroup] )
        = SWITCH (
            TRUE (),
            SELECTEDVALUE ( Parameter[Parameter] ) >= 30
                && SELECTEDVALUE ( Parameter[Parameter] ) <= 39, "30-39 years old",
            SELECTEDVALUE ( Parameter[Parameter] ) >= 40
                && SELECTEDVALUE ( Parameter[Parameter] ) <= 59, "40-59 years old",
            SELECTEDVALUE ( Parameter[Parameter] ) >= 60, "60+ years old"
        ), 1,
    BLANK ()
)

Put Measure in the Filter of the view and set it equal to 1.

vzhangti_0-1649039342017.png

The results are shown in the figure.

vzhangti_1-1649039404435.pngvzhangti_2-1649039419420.png

 

Best Regards,

Community Support Team _Charlotte

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

Hi @v-zhangti , thank you for this! It's working! Saved me a lot of time. You're amazing!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors