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
paulorojog
Regular Visitor

Get last value from another table

Hi!

 

I'm struggling to get a matrix on my dashboard that shows the last project that an employee has been assigned.

 

For this I have two tables. The first one is Employee, that has IDEmployee, NameEmployee and other data, and a second table  Projects, with fields IDProject, IDEmployee, ProjectName, ProjectClient, ProjectMonth (an integer), etc.

 

So, one Employee is asigned to differents projects. I have built a matrix on my dashboard with the list of all employees and other data from this table and then I tried to add the ProjectName choosing Last, but this has returned the last by name sorted, so not necessary is the last project that the employee had been assigned.

 

I need the last record added or last project based on current month. If the employee doesn't have any project this month, it should return null or blank.

 

Thank you for your help in advance!

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

Hi, @paulorojog ;

You could modify it .

Last client = 
var _table=SUMMARIZE(FILTER('NSR',EOMONTH([Periodo],0)=EOMONTH(TODAY(),0)),[Numero Profesional])
return IF(NOT( MAX('Dotación'[Nº pers.])) in _table ,BLANK(),
         CALCULATE(max(NSR[Cliente]),LASTNONBLANK('Calendar'[Date],CALCULATE(max(NSR[Cliente])))))
Last project = 
var _table=SUMMARIZE(FILTER('NSR',EOMONTH([Periodo],0)=EOMONTH(TODAY(),0)),[Numero Profesional])
return IF(NOT( MAX('Dotación'[Nº pers.])) in _table ,BLANK(), 
          CALCULATE(max(NSR[Texto]),LASTNONBLANK('Calendar'[Date],CALCULATE(max(NSR[Texto])))))

The final output is shown below:

vyalanwumsft_0-1643610083658.png
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

8 REPLIES 8
v-yalanwu-msft
Community Support
Community Support

Hi, @paulorojog ;

You could modify it .

Last client = 
var _table=SUMMARIZE(FILTER('NSR',EOMONTH([Periodo],0)=EOMONTH(TODAY(),0)),[Numero Profesional])
return IF(NOT( MAX('Dotación'[Nº pers.])) in _table ,BLANK(),
         CALCULATE(max(NSR[Cliente]),LASTNONBLANK('Calendar'[Date],CALCULATE(max(NSR[Cliente])))))
Last project = 
var _table=SUMMARIZE(FILTER('NSR',EOMONTH([Periodo],0)=EOMONTH(TODAY(),0)),[Numero Profesional])
return IF(NOT( MAX('Dotación'[Nº pers.])) in _table ,BLANK(), 
          CALCULATE(max(NSR[Texto]),LASTNONBLANK('Calendar'[Date],CALCULATE(max(NSR[Texto])))))

The final output is shown below:

vyalanwumsft_0-1643610083658.png
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

paulorojog
Regular Visitor

Thank you! Your solution is the expected behavior. The only thing is still missing is how I could get with this that if an employee does not have a project assigned in the current month, the columns should be in blank.

You are welcome.  Drag Month from the Calendar Table into a slicer and select a certain month.  Do you not get the expected result?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
paulorojog
Regular Visitor

Hi, 

 

You should be able to download a sample of the document in this link.

 

Here you have a reduced sample of the file. There are three tables:

 

  • Dotacion: table of employees
  • NSR: table of projects
  • Utilization: table of time dedicated to projects per month per employee

As I said, I need to create a summary matrix that for each employee I can see their utilization (that's OK) and the last project and client they were assigned. If in that month, the employee was not assigned to any project, it should appear in blank. The problem is that if I add the project name (text field) and client, the current matrix brings the last ordered by name. 

 

Thank you!

Hi,

To know the last project and client they were assigned to is not difficult because you have a Date column in the NSR table - so that can be done.  However, in the utilisation table, there is no Date column.  So this table would not respond to a Year/Month that we select in a slicer.  Therefore, the utilisation figure in your matrix visual will appear incorrect.

FYI, to know the last project and client, you may use the LASTNONBLANK() function. 


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

Could you be more specific with your proposal? Is your suggestion I use LASTNONBLANK() as a column in a table or as a measure. If it is in a table, which table do you suggest? Employee table? And if it is Employee table, how I call the other table with that function.

 

Should be the expression LASTNONBLANK('NSR'[Text], Month('NSR'[Date]) = Month(ReportMonth))? 

 

Thank you!

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/
Ashish_Mathur
Super User
Super User

Hi,

Share the link from where i can download your PBI file.


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

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