Working out time remaining (Modulo)

  • So I have a simple cube, a measure of total time (in seconds), to support better usage in reports I wanted to add a total remaining minutes & seconds as separate calculations so that these can be turned into HH:MM:SS as total duration.

    For example:

    Seconds - 3139628

    Total Hours - 872 (working in cube)

    Remaining minutes - 07 (need to calc)

    Remaining seconds - 08 (need to calc)

    These calcs would then be used to create a value in a report of 872:07:08 for total time. I can get this working in excel using the MOD function in excel

  • I seem to recall that with SSAS you have to use the form A-(INT(A/B)*B) as a substitute for A%B, since SSAS lacks a modulo operator.

    That would work out to something like this:

    HH=seconds/3600

    MM=INT((seconds-(INT(seconds/3600)*3600))/60)

    SS=seconds-(INT(seconds/60)*60)

    Cheers!

    EDIT: Fixed a typo.

  • Thanks for the quick response! Worked perfectly... Thank you very much!

Viewing 3 posts - 1 through 2 (of 2 total)

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