Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ank1997
Microsoft Employee
Microsoft Employee

DAX Function for finding the average

Hi all! 

 

I have been stuck on this for a while and was wondering if anyone can help me!

 

I have an excel that has a list of job ID numbers (some that are repeated, 200+ rows) in one column and current application status (applied, rejected, screening) in another. I want to find the average number of applications(current status) per job ID but I have been stuck on getting this to work properly on my power BI. 

 

ank1997_0-1644949502068.png

 

 

Any ideas on how I can do this? I appreciate the help in advance! 

1 ACCEPTED SOLUTION
v-cazheng-msft
Community Support
Community Support

Hi @ank1997 ,

 

You may try this Measure if you still have problems on it.

CurrentStatusAvgForPerID =

VAR CountStatus =

    CALCULATE (

        COUNT ( 'Table'[current_status] ),

        ALLEXCEPT ( 'Table', 'Table'[job_id], 'Table'[current_status] )

    )

VAR CountStatusPerID =

    CALCULATE (

        COUNT ( 'Table'[current_status] ),

        ALLEXCEPT ( 'Table', 'Table'[job_id] )

    )

VAR Table_ =

    SUMMARIZE (

        VALUES ( 'Table' ),

        'Table'[job_id],

        'Table'[current_status],

        "Div", CountStatus / CountStatusPerID

    )

RETURN

    SUMX ( Table_, [Div] )

 

The result should look like this.

vcazhengmsft_0-1646116084830.png

 

Also, attached the pbix file as reference.

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

View solution in original post

4 REPLIES 4
v-cazheng-msft
Community Support
Community Support

Hi @ank1997 ,

 

You may try this Measure if you still have problems on it.

CurrentStatusAvgForPerID =

VAR CountStatus =

    CALCULATE (

        COUNT ( 'Table'[current_status] ),

        ALLEXCEPT ( 'Table', 'Table'[job_id], 'Table'[current_status] )

    )

VAR CountStatusPerID =

    CALCULATE (

        COUNT ( 'Table'[current_status] ),

        ALLEXCEPT ( 'Table', 'Table'[job_id] )

    )

VAR Table_ =

    SUMMARIZE (

        VALUES ( 'Table' ),

        'Table'[job_id],

        'Table'[current_status],

        "Div", CountStatus / CountStatusPerID

    )

RETURN

    SUMX ( Table_, [Div] )

 

The result should look like this.

vcazhengmsft_0-1646116084830.png

 

Also, attached the pbix file as reference.

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly.

I tried to create a sample data like below.

Please check the below picture and the attached pbix file.

 

Picture1.png

 

expected result measure: =
VAR newtable =
ADDCOLUMNS (
VALUES ( Data[Job_ID] ),
"@rowcount", CALCULATE ( COUNTROWS ( Data ) )
)
RETURN
IF ( HASONEVALUE ( Data[Current_Status] ), AVERAGEX ( newtable, [@rowcount] ) )


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Thanks a lot! I tried this out and it worked great! Only issue that I'm having is that some Job IDs show blanks but I have a whole list of applications for it. 

tamerj1
Super User
Super User

Hi @ank1997 

Select matrix visual. Drag the ID's in the raws.  Drag current_status in the coulmns. 
Create measure

Number of Applications = COUNTROWS ( "table name" )

 Select any application type from the slicer and you'll get the number of its applications. 
If you mean by "average" the percentage out of total then create measure

% of Applications =
[Number of Applications] / CALCULATE ( COUNTROWS ( "table name" ), ALL ( [current_status] )

Drag the last measure into the values

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.