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
Anonymous
Not applicable

Filter by two dates (different areas)

Hey there,

 

Is there any filter to perform calculations based on two dates, namely start and end date? In this example, I've assigned dates to employees and I aim to calculate the sum of the Target measure, but filtering by the Area slicer, (in this case) Peter shouldn't be there - both in the chart and in the card that displays “3”, because he has never been assigned to such Area.

pedrohp503_0-1654177965530.png

 

I know there should be a relationship between Info_Employee and Fact_tbl, but I didn't find a way to do so. I figured that it should be done throught the USERELATIONSHIP() function, however I got stucked there, because I don't know how to do the further steps to make such formula to count people who was part of this area in the filtered period of time.

 

To sum my doubt up, what I'd like to do is firstly count how many people were part of this area in a given period of time, and then calculate the sum of those who have been assigned to the filtered area.

 

The count formula is 

DISTINCTCOUNTNOBLANK(Fact_tbl[Employee])

 and the sum is just 

pedrohp503_1-1654178368186.png

 

Thanks in advance.

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , Can refer to this example

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970

 

also check -  Average of Rolling, Average of Snapshots: https://youtu.be/_pZRdLAJxxA

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

hey buddy

 

Ive tried what you suggested, and even following your youtube video I couldn't make it work. However I figured a way to work this around by using the LOOKUPVALUE, but once again I got stuck in a problem: is it possible to use not the first but instead the Nth value in a list? For instance, in this link i've previously provided I would like to get not the first, but the second result contained in the Info_Employee table.

 

pedrohp503_0-1655255580999.png

 

Area = LOOKUPVALUE(Info_Employee[Area] , Info_Employee[Employee] , Dim_Employee[Employee])

A table of multiple values was supplied where a single value was expected.

 

pedrohp503_1-1655255694650.png

This hypotetical scenario should bring Peter in the “Finances” area (in my real case scenario I'll make this work through the week in the Fact table, and the condition is going to be in what area the person is in the filtered date range in a table like the one shown above). Having this in mind, do you know a way to make the LOOKUPVALUE function work with more than one register?

 

Once again, thanks in advance 🤝

Anonymous
Not applicable

Thanks for your response @amitchandak . As soon as I am able to, I'll definitely check this out.

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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