Forum Discussion
klb0066
8 years agoFrequent Visitor
if statement
Creating a splicer with title "Has Due Date?" with True or False checkboxes. Coded an if statement that recognizes if field was left bank then it is false and if the field has a date it is true. ...
Smauro
8 years agoSolution Sage
Hey klb0066
I'm guessing [hasDue] is a column, so, you could either a) create a new column and refresh the model every day or b) have a measure and have a table visual with what you need.
a)
isDue = IF ( [hasDue] && [TARGETFINISH] <= TODAY() , TRUE(), FALSE() )
Which checks if your [hasDue] is true and the finish target was before or today. One thing you may want to check with your data is whether you have items which are already finished in your table. If so you'll need another clause like NOT([Completed]) or [CompletedDate]=BLANK()
b)
isDue =
VAR d =
SELECTEDVALUE ( MX_TICKET[hasDue] )
VAR tf =
SELECTEDVALUE ( MX_TICKET[TARGETFINISH] )
RETURN
IF ( d && tf <= TODAY (), TRUE (), FALSE () )Which does the same as previous, but the table visual should contain a table key (meaning no row is aggregated)