Forum Discussion

lalaVee77's avatar
lalaVee77
New Member
1 year ago
Solved

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.

5 Replies