[JIRA 6 / EAZYBI] "rounding" values

Jerome Renaud May 26, 2015

Hi all,

I want to count time spent by users with the following formula:

If (for each day) user logged more than 7 hours then count "1 day" 
else (for each day) user logged more than 3 hours bu less than 7 hours then count "0.5 day"
else count "0"

The idea is to truncate hours into days spent for accounting purposes. I don't want to have real "project" values (aka real time spent on tasks), just a truncated to days values. Thank you for your help.

Jerome 

1 answer

1 accepted

0 votes
Answer accepted
Raimonds Simanovskis
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 28, 2015

Hi Jerome

You can create define a calculated measure with a name "Rounded days" and with a formula

Sum(
  Descendants([Logged by].CurrentMember, [Logged by].[User]) *
  Descendants([Time].CurrentHierarchyMember,
    [Time].CurrentHierarchy.Levels('Day')),
  CASE
  WHEN [Measures].[Hours spent] >= 7 THEN 1
  WHEN [Measures].[Hours spent] >= 3 THEN 0.5
  END  
)

Descendants function will drill from the current Logged by and Time dimension members into detailed set of User level members and Day level members. And when we multiply the sets with * operator then cross join of all possible combinations is created.

Then for each user and day we perform the calculation and calculate the total sum.

Please see a sample test report where this calculation is included https://eazybi.com/accounts/1632/cubes/Issues#report/test%20rounded%20days

Please take into account that if you have very large number of users in Logged by dimension or if you have selected large Time period then this calculation might not be very fast as the number of user and day combinations will be large.

If you need more detailed help then please contact eazyBI support.

Jerome Renaud June 4, 2015

Hi Raimonds at first try it works fine! Thanks for this and sorry for my late answer.

Suggest an answer

Log in or Sign up to answer