Forum Discussion

NKotak_Leecare's avatar
NKotak_Leecare
Helper III
4 years ago
Solved

Dynamically calculate Average

I need to create a table where we can dynamically group by year and month with average on one axis and total on the other. I have been able to create one but it is static and if I try to make it ...
  • NKotak_Leecare's avatar
    NKotak_Leecare
    4 years ago

    Thank you for your reply. I have actually edited the query and transposed the data in a way I get month-year and all the activites from a single query. I am no longer using the Date Query. Instead, I have used group_by to group it based on the activity dates and get the sum for each activities. Next step, I put conditional columns to get the number of sessions occured in a month-year by checking the sum column of that particular activity - i.e. if the sum is > 0 the output in conditional column in 1. Hence I get the number of sessions occured in a month - year. After that, I transposed the query and got columns as month-year and all activities in the row. Then I calculated Average using this Power Query - each List.Average(Record.FieldValues(_ & [Session Type = null])). It did work perfect!