Forum Discussion

myti's avatar
myti
Helper II
9 years ago

Date format problem

Dear Experts,

 

I have a calculated Measure which is  an output in Date format like 1/1/2017. Once I want to use this output in if condition I can not get the correct answer and "if condition" can not recognise it.I dont know how I may have both in the same format to compre them in a if conditon. my current if condition is as below: I expect that the below formulah return 1 once Measure=1/1/2017.however it doesnt recognise them as equal and return 0. any idea how I can fix it?

 

CalculatedColumn=IF([Measure]=DATE(2017,1,1),1,0 )

 

Thank you,

Best Regards

Mehdi

10 Replies

  • JoHo_BI's avatar
    JoHo_BI
    Responsive Resident

    Hi Myti,

     

    Try converting your measure to a date too, such as:

     

    CalculatedColumn=IF(DATE(YEAR([Measure]), MONTH([Measure]), DAY([Measure]))=DATE(2017,1,1),1,0

     

    Hope that helps!

    • myti's avatar
      myti
      Helper II

      Hey JoHo_BI,

       

      Thank you for your response.However,It did not work!

      • JoHo_BI's avatar
        JoHo_BI
        Responsive Resident

        Hi myti,

         

        What didn't work about it? What responses/errors did it give?