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
lalaVee77
New Member

Help with SWITCH

Hi Everyone, 

 

I'm relatively new to PBI (former Tableau user).  I've got a dashboard I'm working on where I want to display tickets (from a ticketing system) created over x days ago, giving the user the option to pick either 1 day or 10 days.  

 

I set up a table (not joined to any other) called DaysThreshold and it contains one column (days) with values 1 and 10.

 

I created a new measure in my main data source called Selected days

Selected Days =
SWITCH(
    SELECTEDVALUE('DaysThreshold'[Days]),
        "10",10,
        "1",1
)
 
 
I have a formula that evaluates if the ticket age is greater than Selected days:
Aged Ticket = if(and('Open tickets'[Age]>[Selected Days],'Open tickets'[Order Status]="In Process"), 1,0)
 
I put a slicer on the page, I put the Selected Days into my table results. When I toggle between 1 and 10, the Selected Days in the table changes from 1 to 10, however, Aged Ticket is not evaluating.  If I change from 1 to 10, tickets that are 2 days old, 3 days old, 4 days old are all evaluating as 1 (aged ticket = 1).
 
Why is the Aged Ticket formula not evaluating correctly based on the Selected Days switch?
 
(side note: I've got another SWITCH that allows the user to toggle between # and % and that's working fine.)
 
Any guidance would be greatly appreciated.
1 ACCEPTED SOLUTION

@lalaVee77 Instead of using a Switch and Selected Value Function try with a Numeric parameter and use the measure produced from the parameter in your formula.





Did I answer your question? Give your kudos and mark my post as a solution!

Proud to be a Super User!





View solution in original post

5 REPLIES 5
lalaVee77
New Member

Thanks so much! 

Ashish_Mathur
Super User
Super User

Hi,

Share some data to work with and show the expected result.  Share data in a format that can be pasted in an MS Excel file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
ray_aramburo
Super User
Super User

Hi @lalaVee77 is your DaysThreshold[Days] column a numerical or text type?





Did I answer your question? Give your kudos and mark my post as a solution!

Proud to be a Super User!





I've tried it both ways. 

@lalaVee77 Instead of using a Switch and Selected Value Function try with a Numeric parameter and use the measure produced from the parameter in your formula.





Did I answer your question? Give your kudos and mark my post as a solution!

Proud to be a Super User!





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