Forum Discussion

carlosflores's avatar
carlosflores
Icon for Helper I rankHelper I
8 years ago

Help measures from different related tables

Hey Community, I'm having problems calculating the rotation ratio (been at it for over a week now .__.

 

This are my relationships:

 

 

Ceses = Leaves in company

Ingresos = Hires in the company

Centro de Costos = Clients

Trabajadores Activos = Active workers (not by dates, only updated for 17th sept)

 

I created a Date Table and related leaves and hires. Also I created a Clients table because I couldn't link leaves and hires, it was a many to many relationship. 

 

So I wish to find the employee rotation ratio, filtered by client, month or year. The employee rotation ratio is calculated by dividing the amount of leaves by the amount of active workers, depending if I'm filtering client, month or year. I can't gather data of active workers per day. I can only get the active workers per client for the 17th of september so I figured I could work my way backwards and forwards by adding hires and substracting leaves of each day, since I am able to get that data. For instance if I have 1000 active workers on 17th sept and on the 16th I have 10 hires and 5 leaves, that would mean we had 1000 -10 +5 = 995 actve workers on the 16th.

 

I have created measures for hires and leaves:

 

Leaves = COUNT('Ceses OLA'[TRABAJADOR]) --- This measure was created in the Ceses (leaves) Table

Hires = COUNT('Ingresos OLA'[TRABAJADOR]) --- This measure was created in the Ingresis (hires) Table

 

 **  "TRABAJADOR" has the id for each employee.

 

 

This works when I filter it by month, year or client. 

 

Then I created the measure Hires - leaves:

 

Hires - leaves = COUNT('Ingresos OLA'[TRABAJADOR]) - COUNT('Ceses OLA'[TRABAJADOR])  --- This measure was created in the Centros de Costos (Clients) Table and it also works when I filter the report by client, year or month. This is how it looks:

 

 

I need to find the amount of active workers for each day and this has to be able to be filtered by client, year or month. I have a table with the active workers and have created this measure:

 

Active workers = COUNT('Trabajadores activos OLA'[TRABAJADOR]) --- This measure was created in the Trabajadores activos (Active workers) Table

 

But this information is only for the 17th of september. This would have to be updated daily, It should look like this (I know that on th 17th we have 956 active workers because I have the measure "Active Workers".

 

YearMonthDayHiresLeavesHires - leavesTrabajadores activos
2018Setiembre112111930
2018Setiembre2   930
2018Setiembre3734934
2018Setiembre43 3937
2018Setiembre5716943
2018Setiembre6312945
2018Setiembre714-3942
2018Setiembre814-3939
2018Setiembre9 2-2937
2018Setiembre103 3940
2018Setiembre11918948
2018Setiembre12321949
2018Setiembre133 3952
2018Setiembre14 2-2950
2018Setiembre15110950
2018Setiembre16   950
2018Setiembre17826956
2018Setiembre185 5961
2018Setiembre19422963
2018Setiembre20 3-3960
2018Setiembre2116-5955

 

And it should also be able to be filtered by client, month and year.

 

I'm struggling with this report for over a week pleeeeease I would really appreacite some help on this.

 

Thanks in advance

5 Replies

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

    Hi carlosflores

    Please try to use COUNT function in Calculate function, like CALCULATE(COUNT[Column],ALLSELECTED[Column1])

    I am testing with your scenario and would give feedback later.

     

    Best Regards

    Maggie

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

    Hi carlosflores

    I want to confirm with you what is your expected result.

    For example, "Hires" and "Leaves" are total sum of the whole month, "actives" is the total active workers for the whole 2018/9, then according to information above, we could get the last column/measure which shows total active workers for each month. 

     

     

    Is my understanding right?

    Could you send me a privacy email with your example dataset?

    It has mutiple tables and i need to know more about your data.

     

    Best Reagrds

    Maggie

    • carlosflores's avatar
      carlosflores
      Icon for Helper I rankHelper I

      v-juanli-msft thanks for you help,

       

      "Hires" and "Leaves" are total sum of each day, and can be filtered by month or year or client.

       

      "Actives" is the total of workers on september 17, that's when I collected the data

       

      Your last column "actives2" is actually correct.

       

      Lastly to finally calculate the rotation ratio, I would have to divide leaves/ actives2, and this should be able to be filtered by month, year or client.

       

      Alsi, I sent you a private message with the dataset.

       

      Thank you so much!

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

    Hi carlosflores

     

    my idea to your problem is : 

    1. for 2017/9, Trabajadores Activos for 2017/9/17 is known, then calculate the Trabajadores Activos for each day in 2017/9 based on the Trabajadores Activos for 2017/9/17 and Hires - leaves in each day.

    2.after step1, i will get  total Trabajadores Activos for 2017/9, then use this and Hires - leaves in each month of 2017, i will get Trabajadores Activos for each month of 2017.

     

    As i am going on my national holiday in the following week ,  i have little time implementing my idea in your pbix so that i have stuck in it.

    I make a test pbix to calculate Trabajadores Activos based on each month.

    could you have a look at it, i hope that can provide some ideas for you.

    If it still can't help you, i would continue to work on this problem when i come back, if it is urgent, you could post another thread in the community tp get help from others.

     

     

    Best Regards

    Maggie

    • carlosflores's avatar
      carlosflores
      Icon for Helper I rankHelper I

      Hello v-juanli-msft, first of all I wanted to ley you know how much I appreciate your help on this matter.

       

      Your test pbix works! that's what I'd like to do with my own data. The thing is, I would need to know the Trabajadores Activos por each day as well as each month so I can make reports showing the evolution of this metric over time. Also they should be able to be filtered by Client (on the left).

       

      Just to clarify, with the Trabajadores Activos per day, then I would calculate the employee rotation by dividing the average Trabajadores Activos of the last 4 weeks by the amount of leaves of the past 4 weeks.

       

      I'll wait for you to come back. I really need some help on this matter, I've been struggling with for so long, I almost gave up with it.

       

      Thanks again and happy Holidays!