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! Learn more

Reply
selected_
Helper IV
Helper IV

How to create a calculated column from a measure

I wanna display the latest rating given to an employee. In my data, I have columns 'rating' and 'reviewEndDate' in the 'doc' table, and a 'terminationDate' column in the 'employment' table. I want to return the latest rating record, but only if the termination date is greater than the review end date.

 

the table data look like this:

selected__0-1699472165079.png

 

as you can see, an employee can have multiple rating record but I'm only intrested in the latest rating and reviewEndate that employee got rating which in this case are rating 1. there are cases or records that that reviewEndate higher than the terminationDate but those should be excluded since terminationDate should be higher than reviewEndDate. 

 

 

I managed by creating a measure for that as you can see below and it works fine in a table visual but I  can't put that measure in Legend or Axis in a bar chart so instead i wanna create a calculated column inside the table but when I do it with same measure then I get only one value record in all rows. 

 

what should i do or how to fix it?

 

Rating = 
VAR MaxDate = MAX('doc'[reviewEndDate])
RETURN
IF(NOT ISBLANK(MaxDate),
CALCULATE(
LASTNONBLANK('doc'[rating], 1),
FILTER('doc', 'doc'[reviewEndDate] = MaxDate)
        )
    )

  

1 REPLY 1
Dangar332
Super User
Super User

Hi, @selected_ 

try below

Rating = 
VAR MaxDate = 'doc'[reviewEndDate]
RETURN
IF(NOT (ISBLANK(MaxDate)),
CALCULATE(
LASTNONBLANK('doc'[rating], 1),
FILTER('doc', 'doc'[reviewEndDate] = MaxDate)
        )
    )

Helpful resources

Announcements
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!

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.

Top Solution Authors