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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Issue with ISSELECTED function to detect values selected

Hi,

I have a time dimesnion and slicers built on top of tat, the user has the option to select multiple values in a slicer

Week Slicer  Month Slicer  Quarter Slicer  Year Slicer

 

My requirement is if user selects a week then the measure should use one column say Col A from the fact table and anything above the week, I need to aggregate using Col B from fact table. For this I am using the below formula

 

Week Check= SWITCH(
                                      TRUE(),
                                      Not ISBLANK(SELECTEDVALUE(DIM_WeekK[WK])),1,
                                      Not ISBLANK(SELECTEDVALUE(DIM_Month[Month])),2,
                                      Not ISBLANK(SELECTEDVALUE(DIM_Month[Quarter])),3,
                                      Not ISBLANK(SELECTEDVALUE(DIM_Month[Year])),4

                                   )

 

and in my measure

 
Sales = SWITCH(
                          TRUE(),
                          [Week Check]=1, SUM(Fact[Col A]),
                          [Week Check]>1, sum(Fact[Col B] )
                        )

 

The logic works fine with only one value selected in each slicer, but it breaks when user selects multiple values..Say when user selects 2 weeks in week slicer, I want my query to aggregate from Col A, but due to ISSELECETD function its going to next level and aggreagting from Col B.

 

Please suggest if there is any other alternative

1 ACCEPTED SOLUTION

@Anonymous  sorry to hear that's not working.

 

The logic works in a test model I built, so I guess there is something specific to your model that is stopping the [Week Check] measure working.

 

Could you post a link to a santised PBIX that exhibits the problem?


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

4 REPLIES 4
OwenAuger
Super User
Super User

Hi @Anonymous 

 

You could use ISFILTERED instead, to detect whether any filters are applied to the columns of interest:

 

Week Check =
SWITCH (
    TRUE (),
    ISFILTERED ( DIM_WeekK[WK] ), 1,
    ISFILTERED ( DIM_Month[Month] ), 2,
    ISFILTERED ( DIM_Month[Quarter] ), 3,
    ISFILTERED ( DIM_Month[Year] ), 4
)

 

 

Also, you can change the Sales measure slightly (as the condition depends only on the value of [Week Check] and change it so that it evaluates [Week Check] only once:

Sales =
SWITCH (
    [Week Check],
    1, SUM ( Fact[Col A] ),
    2, SUM ( Fact[Col B] )
)

 

Does that give the intended result?

 

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn
Anonymous
Not applicable

Thanks for the quick response Owen, I tried doing that change but its still not giving the result I am expecting

When I select 2 weeks from week slicer, I expect the Week check to still stay at 1 , but it shows value where only a single value is selected, in my case if I selecetd 2 values in week, 2 in month and  1 value in Qtr then its showing 3 but I am expecting it to show 1.

@Anonymous  sorry to hear that's not working.

 

The logic works in a test model I built, so I guess there is something specific to your model that is stopping the [Week Check] measure working.

 

Could you post a link to a santised PBIX that exhibits the problem?


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn
Anonymous
Not applicable

Thanks Owen, I was using a wrong column, its working now.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors
Top Kudoed Authors