Forum Discussion
UK_User123456
7 years agoResolver I
Returning text based on difference
Hi All, Is there a way of returning text based on a number that I have got e.g. the difference between date(s)? e.g. Date 1 Date 2 Date Difference Text 01/01/2019 01/06/2019 151 ...
- 7 years ago
create a column:
date diference = DATEDIFF(date1;date2;DAY) (use semicolon or comma)create another column:text result = If (date diference <= 50;"New";date diference <= 150;"Existing";"Old")best regards.
jdbuchanan71
7 years agoSuper User
UK_User123456 , You will need to share your model, the measure works in my test:
UK_User123456
7 years agoResolver I
jdbuchanan71see below the screenshots. The data types should are the same, as there are no true/false.
I wanted to be able to say that if the "Date Difference is between a certain number it would return the text I wanted it to display. I have also attached the error message that I receive.
- tex6287 years agoCommunity Champion
Can you share the nested IF statement that you tried? I dont see any reason as to why a nested if statement wouldnt work here!
- jdbuchanan717 years agoSuper User
Is your field 'Date Difference Last Gift (By Day)' a measure of a column from a table?
If you want to change the compare you can change to operator in the measure.
Text = SWITCH( TRUE(), [Date Difference] < 50, "New", [Date Difference] < 151, "Existing", [Date Difference] >= 152, "Old", "Other" )