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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Most recent employee score value for each month

Hi All,

 

I have the a table in the below format. Its the socre card of each employee, however arrear data is also received in some months. 

As an example. For Emp ID 11111 the score received for month Jan was EE however, in the month of March an updated score for employee was received as ME, hence the latest score is ME.

 

Table 

Emp IDIncentive MonthScoreData received month
11111Jan-20EEFeb-20
22222Jan-20MEFeb-20
33333Jan-20NIFeb-20
11111Feb-20EEMar-20
22222Feb-20MEMar-20
33333Feb-20NIMar-20
11111Jan-20MEMar-20
22222Jan-20EEMar-20

 

Desired output. 

 

 Incentrive Month
Emp IDJan-20Feb-20
11111MEEE
22222EEME
33333NINI

 

 

Please help. 

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

Hi, @Anonymous 

 

Based on your description, I created data to reproduce your scenario.

Table:

b1.png

DateTable:

b2.png

 

Here are the calculated columns and measure i created.

 

Columns:
Incentive Month = FORMAT('Table'[Incentive Date],"mmm-yy") 
Data received Month = FORMAT('Table'[Received Date],"mmm-yy")

Measure:
NewScore = 
var _currentemp = MAX('Table'[Emp ID])
var _currentincentivemonth = MAX('Table'[Incentive Month])
var _date = 
CALCULATE(
    MAX('Table'[Data received Month]),
    FILTER(
        'Table',
        'Table'[Emp ID] = _currentemp&&
        'Table'[Incentive Month]=_currentincentivemonth
    )
)

var _monthyear = FORMAT(_date,"mmm-yy")

return
LOOKUPVALUE('Table'[Score],'Table'[Incentive Month],_currentincentivemonth,'Table'[Emp ID],_currentemp,'Table'[Data received Month],_monthyear)

 

 

Finally, you may use the matrix visual to display the result.

b3.png

 

Best Regards

Allan

 

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

4 REPLIES 4
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I created data to reproduce your scenario.

Table:

b1.png

DateTable:

b2.png

 

Here are the calculated columns and measure i created.

 

Columns:
Incentive Month = FORMAT('Table'[Incentive Date],"mmm-yy") 
Data received Month = FORMAT('Table'[Received Date],"mmm-yy")

Measure:
NewScore = 
var _currentemp = MAX('Table'[Emp ID])
var _currentincentivemonth = MAX('Table'[Incentive Month])
var _date = 
CALCULATE(
    MAX('Table'[Data received Month]),
    FILTER(
        'Table',
        'Table'[Emp ID] = _currentemp&&
        'Table'[Incentive Month]=_currentincentivemonth
    )
)

var _monthyear = FORMAT(_date,"mmm-yy")

return
LOOKUPVALUE('Table'[Score],'Table'[Incentive Month],_currentincentivemonth,'Table'[Emp ID],_currentemp,'Table'[Data received Month],_monthyear)

 

 

Finally, you may use the matrix visual to display the result.

b3.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

amitchandak
Super User
Super User

Do you have Data received date also, or only formatted month? because if it a date or can be converted to date, We can use a Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedinformula like

calculate(max(table[Score]),
	filter(summarize(table,table[Emp ID],"_maxdt",max(table[Data received date]),"_maxGp",max(table[Emp ID])),
			table[Emp ID]=[_maxGp] && max(table[Data received date]=_maxdt)))

 

 

Anonymous
Not applicable

@amitchandak

Really appreciate you helping me on this.

Yes all dates are proper dates 1 Jan 2020 ,  Can you please provide details on where to put this formula. As in new Measure, or column or table.

This Should be a measure

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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