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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

returning the count and average age of open jobs

hi so ive hit a wall with this one,

bassically ive the below table format 

open dateclosed dateAge days
01/02/202201/03/202230
01/02/202201/03/202230
01/02/202201/03/202230
01/02/202201/03/202230
01/02/202201/03/202230
08/02/202201/03/202221
08/02/202201/03/202221
08/02/202208/04/202260
08/02/202208/04/202260
08/02/202208/04/202260

 

what im tring to get is a graph that had date along the bottom and then for each date plotted it gives a count for each job that was open during that date aka for 02/02/2022 count would be 5, id also then need a average age for the jobs that are open on that same period for the same date "09/02/2022" the average age should be 27.43

 

ive tried using a mesure similar to this but it sinst getting the expected results 

var active = CALCULATE(COUNTROWS('Job table'), // Create Variable and count rows of Table1
ALL('Date Table'[Date]),'Date Table'[Date]<=maxdate, // Include all rows in date table up to the last date of the filter
ISBLANK('Job table'[Closed date]) || // Exclude rows up with blank Close Date (|| = OR)
'Job table'[Closed date] >=maxdate )

RETURN 

active

 

any help appreciated

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

You can create a measure as below to get the count of active job:

Active job Count =
VAR __DATE =
    MAX ( 'Date Table'[Date] )
RETURN
    SUMX (
        'Job table',
        IF (
            'Job table'[Open Date] <= __DATE
                && OR (
                    'Job table'[Closed date] >= __DATE,
                    ISBLANK ( 'Job table'[Closed date] )
                ),
            1,
            BLANK ()
        )
    )

And you can refer the following links to get it:

1. Get the count of active xxx

How Many Staff Do We Currently Have – Multiple Dates Logic In Power BI Using DAX

yingyinr_0-1661395982869.png

Create inactive relationships


yingyinr_1-1661395982875.png

Create measure

yingyinr_2-1661395983032.png

Create visuals

Count Amount of Active Employees by period

Counting “Active” Rows in a Time Period: Guest Post from Chris Campbell

2. Get the average of age

Calculating Ave Age of Active Employees

Average Age = 
CALCULATE (
    AVERAGE(AllStaff[Age]);
    FILTER (
        AllStaff;
        NOT(AllStaff[Last Date Worked] = BLANK())
    )
)

 

If the above ones can't help you get the desired result, please provide some raw data in the table "Job table" (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

it took me a bit to understand what you ment, i is a solution but i dont see how ill be able to build off of that to get the average age og the jobs 

 

Hi,

For any date, how should average days be calculated?  Please explain.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

it should take a date and then find all jobs with a opendate erlier and a close date later (meaning it was open at that time) then average the age of all jobs that meet that criteria.  rethinking the problem on fresh eyes im going to ask anew queswtion that a bit more detailed as i think this is more complex than i first thought thanks for you help!.

Anonymous
Not applicable

Hi @Anonymous ,

You can create a measure as below to get the count of active job:

Active job Count =
VAR __DATE =
    MAX ( 'Date Table'[Date] )
RETURN
    SUMX (
        'Job table',
        IF (
            'Job table'[Open Date] <= __DATE
                && OR (
                    'Job table'[Closed date] >= __DATE,
                    ISBLANK ( 'Job table'[Closed date] )
                ),
            1,
            BLANK ()
        )
    )

And you can refer the following links to get it:

1. Get the count of active xxx

How Many Staff Do We Currently Have – Multiple Dates Logic In Power BI Using DAX

yingyinr_0-1661395982869.png

Create inactive relationships


yingyinr_1-1661395982875.png

Create measure

yingyinr_2-1661395983032.png

Create visuals

Count Amount of Active Employees by period

Counting “Active” Rows in a Time Period: Guest Post from Chris Campbell

2. Get the average of age

Calculating Ave Age of Active Employees

Average Age = 
CALCULATE (
    AVERAGE(AllStaff[Age]);
    FILTER (
        AllStaff;
        NOT(AllStaff[Last Date Worked] = BLANK())
    )
)

 

If the above ones can't help you get the desired result, please provide some raw data in the table "Job table" (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors