Date Difference

  • Hi all,

    I have a report that can be run between any two dates. For example lets say between May 1st and May 31st. I have a Days Remaining field in the report, which is the number if days between the day the report was run (lets say May 12th) and the last day of the reporting period (May 31st). Days Remaining will be 19 in this case. Is there a way to achieve this through a Calculated Member? If not, what is the best way to do this?

    My report is in excel. Any help will be greatly appreciated. Thanks in advance.

    R

  • I think I found the solution...

    datediff(

    "d",

    Now(),

    [Transaction Date].[Day Of Month].CurrentMember.MemberValue

    )

  • Oops... No luck... Although the formula works, I am unable to find the find the last date in the current reporting period. Can anybody help?

  • hi

    i think month last is fixed, u have to find on current date and subtract from the last date.

    then u can try

    declare @today as int

    set @today = datepart(dd,getdate())

    this way u can fine todays date and simply subtract if from last day of month and u get the remaining days.

    --hope so it working

    with regards

    Pubbs

  • you might be able to make use of the LastChild MDX function to find the last member in the parent, so for e.g.[Time].CUrrentMember.Parent.LastChild should get you the last child in the same reporting period as the current date.

    Steve.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply