Reputation: 3
I have the following situation from the formula at Report Builder 3.0:
=IIF(Previous(Fields!Id.Value) = Fields!Id.Value,
Fields!DateStart.Value - Previous(Fields!DateFinish.Value),
"NA")
Outuput: 01:55:33:2400000
Desired Output: 01:55 H
Tried to use the FormatDateTime and others, however no value is retrieved.
Appreciate any hint.
Upvotes: 0
Views: 45
Reputation: 395
To elaborate on @HannoverFist's answer to include the "H"
=IIF(Previous(Fields!Id.Value) = Fields!Id.Value,
FormatDateTime(Fields!DateStart.Value - Previous(Fields!DateFinish.Value), "hh:mm") + "H", "NA")
Upvotes: 0
Reputation: 10860
I believe the issue is that you are using N/A for some of the fields which is causing your date type to be converted to text.
If you want to keep the N/A, I would try formatting the Time inside the THEN part of the IIF statement. Converting/Formatting Date/Times actually changes the type to text which IS compatible with the N/A.
=IIF(Previous(Fields!Id.Value) = Fields!Id.Value,
FormatDateTime(Fields!DateStart.Value - Previous(Fields!DateFinish.Value), "hh:mm"),
"NA")
I'm not sure what the H is for. :(
Desired Output: 01:55 H
Upvotes: 1