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

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

Reply
Anonymous
Not applicable

Compute the Number of Interns Using Start Date and End Date and be able to Filter by Unit and Region

Hi People,

I am new to power BI. My issue is below: I want to be able to computer the number of interns present in the company using start date and end date and then also be able to filter by units, regions, internship_type, gender etc. Searching in this community, I found a measure able to do that as below (calculating the number present in a month):

 

number_of_interns_present_count = 
			
VAR endOfPeriod = MAX ( 'DimDate'[Date] ) 

VAR startOfPeriod = MIN( 'DimDate'[Date] )
RETURN
    CALCULATE (
        COUNTROWS ( 'internship interns' ),
        FILTER (
            ALL('internship interns'),
               ( 'internship interns'[effective_start_date] <= endOfPeriod
                         && 'internship interns'[effective_end_date] >= startOfPeriod)
        )
    )

However, my challenge now is that "number_of_interns_present_count" is same for all Units and Regions

 

Below is my model. Notice that I deactivated the relationship betweem DimDate and Interns effective start date thinking that was the problem but no change. When I am doing a simple count of interns and link DimDate to effective_start_date, I am able to get the number of interns starting in a particular month by Unit and Region when you select a month on the slicer. Please how can I filter by department, unit, gender, internship type etc for this case. For each of these filters the number of interns present is thesame through out. It is not splitted by any of the above.

 

Sample Model.PNG

 

 

 

 

1 ACCEPTED SOLUTION
TeigeGao
Solution Sage
Solution Sage

Hi @Anonymous ,

The DAX query ypu shared can solve the problem computering the number of interns present in the company using start date and end date well. If you want to add the filters, you can change the ALL() function to ALLEXCEPT() function to rule out the units, regions, internship_type, gender.

Best Regards,

Teige

View solution in original post

5 REPLIES 5
TeigeGao
Solution Sage
Solution Sage

Hi @Anonymous ,

The DAX query ypu shared can solve the problem computering the number of interns present in the company using start date and end date well. If you want to add the filters, you can change the ALL() function to ALLEXCEPT() function to rule out the units, regions, internship_type, gender.

Best Regards,

Teige

Anonymous
Not applicable

Hi @TeigeGao ,

 

Thanks alot. ALLEXCEPT works perfectly

 

Best Regards,

 

Divo

Anonymous
Not applicable

Hi @TeigeGao ,

 

The DAX query gives me the number of interns present correctly. However, my problem now is that it does not distribute the value correctly accross Units, Regions, Gender etc. The value is thesame. See visual below. How can I solve this?

 

Interns by Gender.PNGInterns by Unit and Region.PNG

Hi @Anonymous ,

As mentioned in my above reply, you need to use allexcept() function to rule out these filters, because you areusing a all() function in your query, it will remove all filters, then it will display the same value.

Please refer to this blog: https://www.sqlbi.com/articles/using-allexcept-versus-all-and-values/

Best Regards,

Teige

Anonymous
Not applicable

Hi @TeigeGao ,

 

Thanks. Let me try this and see the result

 

Best regards,

 

Divo

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.