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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
rosscortb
Post Patron
Post Patron

Measure that returns the current value

Hello,

 

Hoping you can help.

I have two tables, headcount and Submitted Approved.

I have used this measure to bring in the sector that the employees works in from the headcount table to the Submitted Approved table. I haven't used lookup as gives the error of to many values when one is expected.

 

Sector = CALCULATE(FIRSTNONBLANK(Headcount[Sector],1),
FILTER(Headcount,Headcount[SAP] = SubApproved[SAP ID]
))
 
This works fine, however, it seems to return the wrong value if an employee has changed sector at some point.
 
In the example below using the measure above these two employees are showing as 
SAP ID        Sector
1848321     Corp Mgt( should be Finance)
2638713     Corp Mgt
 
If I swap firstnonblank to lastnonblank if get
 
SAP ID        Sector
1848321     Finance(correct)
2638713     Thermal(should be Corp Mgt)
 
Any ideas?
Thanks Ross
4 REPLIES 4
v-diye-msft
Community Support
Community Support

Hi @rosscortb 

 

you might consider creating pbix file that will contain some sample data (remove the confidential info), upload the pbix to onedrive for business and share the link to the file. Please do not forget to describe the expected results based on this sample data.

 

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
MFelix
Super User
Super User

HI @rosscortb ,

 

If you have a date field in both table you should use it to make an additional filter on your values so that you can have the correct result at the correct time.

 

Can you share some sample data?


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi, I do have have two dates fields in the submitted and approved which is basically start and end date for annual leave so don't think its relevant

 

Hi @rosscortb ,

 

If you don't have any start and end date how do you know the Sector of a specificic employee at a certain time?

 

Can you share a sample data and setup of the relationships in you model?


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors
Top Kudoed Authors