Forum Discussion

natthachai's avatar
natthachai
New Member
3 years ago

count and average

I look for the response to questions I'm not sure how to ask. I constantly update new information. There are multiple rows in each day. I can count the number of rows. However, I prefer to average across weeks or months. to use this table in power bi. I can configure the specified date to count using the example. But I'm unable to select the average. Please let me know. Should the table have a calculation column added? How do I select and set it up?

 

DateSubjectDetail
2/4/2023VideoVideo provides a powerful way to help you prove your point. 
2/4/2023WhenWhen you click Online Video, you can paste in the embed code for the video you want to add. 
2/4/2023YouYou can also type a keyword to search online for the video that best fits your document.
2/4/2023ToTo make your document look professionally produced, Word provides header, footer, cover page, and text box designs that complement each other. 
2/4/2023ForFor example, you can add a matching cover page, header, and sidebar. Click Insert and then choose the elements you want from the different galleries.
2/5/2023VideoVideo provides a powerful way to help you prove your point. 
2/5/2023WhenWhen you click Online Video, you can paste in the embed code for the video you want to add. 
2/5/2023YouYou can also type a keyword to search online for the video that best fits your document.
2/5/2023ToTo make your document look professionally produced, Word provides header, footer, cover page, and text box designs that complement each other. 
2/6/2023ForFor example, you can add a matching cover page, header, and sidebar. Click Insert and then choose the elements you want from the different galleries.
2/6/2023VideoVideo provides a powerful way to help you prove your point. 
2/6/2023WhenWhen you click Online Video, you can paste in the embed code for the video you want to add. 
2/6/2023YouYou can also type a keyword to search online for the video that best fits your document.
2/6/2023ToTo make your document look professionally produced, Word provides header, footer, cover page, and text box designs that complement each other. 
2/6/2023ForFor example, you can add a matching cover page, header, and sidebar. Click Insert and then choose the elements you want from the different galleries.

2 Replies

  • ValtteriN's avatar
    ValtteriN
    Community Champion

    Hi,

    I am not entirely sure I understood your question, but you can get the average of the row totals like this:

    measure 39 = IF(isblank(SELECTEDVALUE('Table (25)'[Date])), //check if row is total
       
        DIVIDE(counta('Table (25)'[Detail]),COUNTROWS(VALUES('Table (25)'[Date]))), //calculate Average for total row
        counta('Table (25)'[Detail])) //count values


    Example:

     

    Count for months is 5 and 4 respectively and their average is 4.5

    I would solve this in dax instead of PQ since your goal seems to be to have a dynamic calculation depending if week or month is selected for filtering.


    I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

    My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/

    • natthachai's avatar
      natthachai
      New Member

      I appreciate your suggestion. I'm not sure I can adhere to this instruction. I'm not very good at understanding, but I'll attempt to learn. thanks once again