Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
davyqliks
Specialist
Specialist

Date with if statement

Hi Experts,

I hope you are all keeping safe and well.

I have 2 dates in my data load

Issue Date
Voucher Date

My calendar is powered by the Voucher Date.

Voucher date is created when an invoice is posted but i also need to include the Issue date in the model and so wanted to employ an if statement to capture Issue Date as Voucher Date if the voucher date is blank.

Here is my best (just realised not working ) effort.

Date(if(( len([Voucher Date])=0) or [Voucher Date]>0 ,[Voucher Date],[Issue date] ),'DD/MM/YYYY') as [Voucher Date],

Can anyone help to modify this to capture issue date as Voucher date when the voucher date is blank?

Thank you

Daniel

Labels (3)
1 Solution

Accepted Solutions
dplr-rn
Partner - Master III
Partner - Master III

if( isnull([Voucher Date]) ,[Issue date] ,[Voucher Date])

View solution in original post

4 Replies
dplr-rn
Partner - Master III
Partner - Master III

your logic seems correct. try changing it to simple isnull() condition

if thats not working either i  feel there maybe some other data coming in. maybe spaces.

davyqliks
Specialist
Specialist
Author

Hi,

Thank you for this.

I am having trouble writing the load statement with the isnull() condition.

Please can you show in my example how you would add this as i am having issue getting syntax correct.

Thank you

dplr-rn
Partner - Master III
Partner - Master III

if( isnull([Voucher Date]) ,[Issue date] ,[Voucher Date])

davyqliks
Specialist
Specialist
Author

Thank you,

This worked perfectly.

 

Stay safe out there

 

Daniel