Forum Discussion

dw700d's avatar
dw700d
Post Patron
5 years ago
Solved

Calculate average count per month

Good day,

I am trying to calculate the average total count of "Location Codes" per month.For instance, in the below chart the average count per month is 3.5

 

Location CodeCreation Date
17/22/2020
27/22/2020
38/22/2020
48/23/2020
58/24/2020
68/25/2020
79/1/2020
89/2/2020
99/3/2020
109/4/2020
1110/1/2020
1210/2/2020
1310/3/2020
1410/4/2020
  • dw700d  try this

     

    Avg = 
    AVERAGEX ( VALUES ( Table[Month] ), CALCULATE ( COUNTROWS ( Table ) ) )

     

    Assuming you have a month column in your table, or I would recommend adding a date dimension in your model, and then use a month column from that dimension, you can simply add one as per my blog post.

     

    Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

    Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

4 Replies

  • dw700d it should be a simple measure

     

    Avg = AVERAGE ( Table[Location] )

     

    Put month and avg in a table visual to see the result.

     

    Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

    Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

    • dw700d's avatar
      dw700d
      Post Patron

      thanks for your help parry2k , but my location code column is text  and I am trying to calculate the count of that text column.  How do I calculate the average count  of  a text column?

      • smpa01's avatar
        smpa01
        Community Champion

        dw700dcan you please explain how the average count per month is 3.5.

        This is what I see

         

  • dw700d  try this

     

    Avg = 
    AVERAGEX ( VALUES ( Table[Month] ), CALCULATE ( COUNTROWS ( Table ) ) )

     

    Assuming you have a month column in your table, or I would recommend adding a date dimension in your model, and then use a month column from that dimension, you can simply add one as per my blog post.

     

    Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

    Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.