Forum Discussion

PC2022's avatar
PC2022
Helper III
1 year ago
Solved

Calculating average between several columns

Trying to calculate the average number between 3 columns. I get an error "the count function only accepts a column reference as an argument"
 
ScheduleAvg = (AVERAGE(crb87_consultantevaluation[crb87_timelinessofprojectphasesubmittalsd]) + AVERAGE(crb87_consultantevaluation[crb87_timelysubmittalofprogressreportsandschedud]) + AVERAGE(crb87_consultantevaluation[crb87_timelinessofprojectphasedeliverablesandord])) / COUNT(crb87_consultantevaluation[crb87_timelinessofprojectphasesubmittalsd]) + COUNT(crb87_consultantevaluation[crb87_timelysubmittalofprogressreportsandschedud] + COUNT(crb87_consultantevaluation[crb87_timelinessofprojectphasedeliverablesandord]))
  • Please try this

    ScheduleAvg =
    (
    AVERAGE(crb87_consultantevaluation[crb87_timelinessofprojectphasesubmittalsd]) +
    AVERAGE(crb87_consultantevaluation[crb87_timelysubmittalofprogressreportsandschedud]) +
    AVERAGE(crb87_consultantevaluation[crb87_timelinessofprojectphasedeliverablesandord])
    ) / 3

7 Replies

  • Did you mean to use COUNTROWS() ?

     

    Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
    Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
    Please show the expected outcome based on the sample data you provided.

    Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
    Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

  • Hi PC2022 please check this

     

    ScheduleAvg =
    AVERAGEX(
        crb87_consultantevaluation,
        VAR NonBlankCount =
            COUNT(crb87_consultantevaluation[Timeliness of Phase Submittals (A)]) +
            COUNT(crb87_consultantevaluation[Timeliness of Deliverables (C)]) +
            COUNT(crb87_consultantevaluation[Timely Submittal of Reports (B)])
       
        VAR TotalValue =
            crb87_consultantevaluation[Timeliness of Deliverables (C)] +
            crb87_consultantevaluation[Timeliness of Phase Submittals (A)] +
            crb87_consultantevaluation[Timely Submittal of Reports (B)]

        RETURN
            IF(NonBlankCount > 0, TotalValue / NonBlankCount, BLANK())
    )
    • PC2022's avatar
      PC2022
      Helper III

      it is returning the same number for each project and phase

       

  • Please try this

    ScheduleAvg =
    (
    AVERAGE(crb87_consultantevaluation[crb87_timelinessofprojectphasesubmittalsd]) +
    AVERAGE(crb87_consultantevaluation[crb87_timelysubmittalofprogressreportsandschedud]) +
    AVERAGE(crb87_consultantevaluation[crb87_timelinessofprojectphasedeliverablesandord])
    ) / 3

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi PC2022,

     

    As suggested by the super user, please provide sample data that demonstrates your issue, along with the expected outcome. This will help us better understand the problem and provide the right guidance to resolve it.

     

    Regards,

    Vinay Pabbu