mesure distribution in month table (active users)

Hello guys, 

I have a measure that counts employees actively working in a range of time, so the measure looks at the timeframe that has the hiring day before and the termination days after a range date filter. When I ask for a day or a year it works but when I want to distribute one year by month it doesn’t work. For example, I want to analyze in one year filter by 2020 and in the output see in each month of that year the evolution of the staff, the measure that I create sums all the active staff in January  in 2018,2019,2020 and all the staff in February in 2018,2019,2020, and so on for each month instead of count every worker before that month so in January we have all the active staff before 2020 and then the evolution fot that year distribute by month/day/etc. 

Any ideas of can I do? 

My measures are: 

filter: filter_date {
    type: date
    sql: {% condition filter_date %} ${Calendar.date_date} {% endcondition %};;
  }
 

measure:  filter_staff {
    type: sum
    sql: CASE WHEN ${hiring_date} < {% date_end filter_date %} AND ${termination_date} >= {% date_start filter_date %} THEN 1 ELSE 0 END;;
  }

*** we have two views one with the transaccion dates (hiring and termination dates) and one view as calendar of dates where we do the distribution by moth,year,etc.

thank you!!!

0 0 87
0 REPLIES 0
Top Labels in this Space
Top Solution Authors