Forum Discussion

kormosb's avatar
kormosb
Icon for Helper III rankHelper III
7 years ago
Solved

Rolling Calculation in a different way

Hi,

 

I have trouble solving the following measure.

I would lik to calculate the rolling (cumulative) revenue for one person.

 

My calculation is:  DIVIDE(TOTALYTD([net revenue], 'Date table'[Date]),TOTALYTD([count of employees], 'Date table'[Date]),0)

The way it calculates:

(Net revenue for January/count of employees for January) + (Net revenue for February/count of employees for Febarury) + (Net revenue for March/count of employees for March) + ...

 

Although, this is not what I want. I would like to calculate like this:

Net revenue for January + Net revenue for February + Net revenue for March + ... count of employees for January + count of employees for February + count of employees for March...

 

Can you help me which measure I should use?

 

Thanks a lot!

Kind regards,

Benjamin

  • Hi kormosb ,

    You could create variables of TOTALYTD, and then use them to calculate divide.

    Measure =
    var a =  TOTALYTD ( [net revenue], 'Date table'[Date] )
    var b = TOTALYTD ( [count of employees], 'Date table'[Date] )
    return
    DIVIDE ( a, b, 0 )

    If it still doesn't work, can you please share some sample data and the expected results?

     

    Best Regards,

    Xue Ding

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

1 Reply

  • v-xuding-msft's avatar
    v-xuding-msft
    Icon for Community Support rankCommunity Support

    Hi kormosb ,

    You could create variables of TOTALYTD, and then use them to calculate divide.

    Measure =
    var a =  TOTALYTD ( [net revenue], 'Date table'[Date] )
    var b = TOTALYTD ( [count of employees], 'Date table'[Date] )
    return
    DIVIDE ( a, b, 0 )

    If it still doesn't work, can you please share some sample data and the expected results?

     

    Best Regards,

    Xue Ding

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly