Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Expressions that yield variant data-type

Hi All,

 

I need to replace blank end date with the financial year for the start date,

e.g. Start date = 1st august 2016, 

       If End date = blank then End date = 30th June 2017

       ELSE End Date

 

start date and end dates are both date data types and blank year is the year +1 from the start date.

 

blankyear = IF(ISBLANK('ENGAGE smsmt_jobposition'[smsmt_ExpectedEnddate]),DATEADD('ENGAGE smsmt_jobposition'[smsmt_ExpectedStartdate],1,YEAR),'ENGAGE smsmt_jobposition'[smsmt_ExpectedEnddate])

 

I have written then following dax for to replace the end date but it is returning error expressions that yield variant data-type.

 

newenddate = IF(ISBLANK('ENGAGE smsmt_jobposition'[smsmt_ExpectedEnddate]),CONCATENATE(Year('ENGAGE smsmt_jobposition'[Blankyear]),"0630"),'ENGAGE smsmt_jobposition'[smsmt_ExpectedEnddate])

 

The blank year concat is obviously returning a string so how do convert to date via dax?

 

Thanks

 

 

  • Anonymous instead of concatenate you should date function which will be something like date(2019,1,1), it will return date Jan 01st, 2019

     

    in your case it will be

     

    Date(Year('ENGAGE smsmt_jobposition'[Blankyear]),6, 30)

     

1 Reply

  • Anonymous instead of concatenate you should date function which will be something like date(2019,1,1), it will return date Jan 01st, 2019

     

    in your case it will be

     

    Date(Year('ENGAGE smsmt_jobposition'[Blankyear]),6, 30)