Forum Discussion
Monthly Percent in a Table
- 9 years ago
Hi Anonymous,
Could you try the formula below to see if it works in your scenario? :smileyhappy:
Task % = VAR currentMonth = MONTH ( MAX ( 'Table2'[Fecha de trabajo] ) ) VAR currentYear = YEAR ( MAX ( 'Table2'[Fecha de trabajo] ) )
VAR currentPerson =
MAX ( 'Table2'[Id_Persona] ) VAR HoursInTask = CALCULATE ( SUM ( 'Table2'[Horas] ), ALLEXCEPT ( Table2, 'Table2'[Id_Proyecto] ) ) VAR AmountHoursPersonInAllTasks = CALCULATE ( SUM ( 'Table2'[Horas] ), FILTER ( ALL ( 'Table2' ), 'Table2'[Id_Persona] = currentPerson && ( MONTH ( 'Table2'[Fecha de trabajo] ) = currentMonth && YEAR ( 'Table2'[Fecha de trabajo] ) = currentYear ) ) ) RETURN DIVIDE ( HoursInTask, AmountHoursPersonInAllTasks )Regards
Hi Anonymous
Could you please post a mock up of what you expect your result to look like. That will help us fill the gap.
Hello Phil_Seamark,
I need a formula that looks like:
Task% = [Hours in the task]/[Amount of worked Hours in the month of this person in all worked tasks]
- Phil_Seamark9 years ago
Microsoft Employee
Hi Anonymous
This might be getting close
Task % = var HoursInTask = CALCULATE(SUM('Table2'[Horas]),ALLEXCEPT(Table2,'Table2'[Id_Proyecto])) var AmountHoursPersonInAllTasks = CALCULATE( SUM('Table2'[Horas]), FILTER( ALL('Table2'), MONTH('Table2'[Fecha de trabajo])= MONTH(MAX('Table2'[Fecha de trabajo])) && YEAR('Table2'[Fecha de trabajo])= YEAR(MAX('Table2'[Fecha de trabajo])) )) RETURN DIVIDE(HoursInTask,AmountHoursPersonInAllTasks)- Anonymous9 years agoNot applicable
Thanks for answer so quickly Phil_Seamark,
Yes, I have a CalendarTable with month, year, ...
I proved your formula and didn't show me what I need.I think this part don't work fine. It sums all hours of all tasks that I have, the date filter in the part of ALL() don't work.
var AmountHoursPersonInAllTasks = CALCULATE( SUM('Table2'[Horas]), FILTER( ALL('Table2'), MONTH('Table2'[Fecha de trabajo])= MONTH(MAX('Table2'[Fecha de trabajo])) && YEAR('Table2'[Fecha de trabajo])= YEAR(MAX('Table2'[Fecha de trabajo])) ))- v-ljerr-msft9 years ago
Microsoft Employee
Hi Anonymous,
Could you try the formula below to see if it works in your scenario? :smileyhappy:
Task % = VAR currentMonth = MONTH ( MAX ( 'Table2'[Fecha de trabajo] ) ) VAR currentYear = YEAR ( MAX ( 'Table2'[Fecha de trabajo] ) )
VAR currentPerson =
MAX ( 'Table2'[Id_Persona] ) VAR HoursInTask = CALCULATE ( SUM ( 'Table2'[Horas] ), ALLEXCEPT ( Table2, 'Table2'[Id_Proyecto] ) ) VAR AmountHoursPersonInAllTasks = CALCULATE ( SUM ( 'Table2'[Horas] ), FILTER ( ALL ( 'Table2' ), 'Table2'[Id_Persona] = currentPerson && ( MONTH ( 'Table2'[Fecha de trabajo] ) = currentMonth && YEAR ( 'Table2'[Fecha de trabajo] ) = currentYear ) ) ) RETURN DIVIDE ( HoursInTask, AmountHoursPersonInAllTasks )Regards
- Phil_Seamark9 years ago
Microsoft Employee
Hi Anonymous
Do you have a Date Table that has a Month column?