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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

Filter the latest record based of multiple fields

Hi Everyone,


I am Posting this question second time and expecting you guys to help me in this regard.

Emp_NameAllowance Typestrt dateend dateAmount Flag
10234House Rent 3/1/20136/30/20134000 0
10234Social Allowance3/1/20135/30/20135000 0
10234House Rent 7/1/20132/28/20146000 1
10234Basic Salary2/1/20139/30/201314000 0
10234Basic Salary10/1/2135/30/201415000 1
10234School Allowance4/1/20133/20/20153000 1
10234Basic Salary6/1/20147/30/201417000 0
10234Basic Salary8/1/201411/30/201419000 1
       


I have list of records and i want to add a column that mark the latest record as 1 and old as 0 as described below
As you see in the attached screenshot there are number of records against 10234,it has difference allowance types with start and end date of each allowance and amount aswell.
You can see that his  base salary and and house rent changes multiple time in year 2013(start date) and in 2014 only basis salary changes.I want a flag with 1 for lastest record base on employee,allowantype and strt date and for the remaining one put 0 so that i can filter the records.


Thanks




 
 

 

 



1 ACCEPTED SOLUTION

Hi,

Write these calculated column formulas

Year of start date = YEAR(Data[strt date])
Flag = if(Data[strt date]=CALCULATE(MAX(Data[strt date]),FILTER(Data,Data[Emp_Name]=EARLIER(Data[Emp_Name])&&Data[Allowance Type]=EARLIER(Data[Allowance Type])&&Data[Year of start date]=EARLIER(Data[Year of start date]))),1,0)

Hope this helps.

Untitled.png


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

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Thanks  alot @Ashish_Mathur ,that works for me.

You are welcome.


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

Why are there two 1's against Basic salary?


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

Because the last basic salary starts in 2014 and I want the latest record of each allowance type against each year.

Hi,

Write these calculated column formulas

Year of start date = YEAR(Data[strt date])
Flag = if(Data[strt date]=CALCULATE(MAX(Data[strt date]),FILTER(Data,Data[Emp_Name]=EARLIER(Data[Emp_Name])&&Data[Allowance Type]=EARLIER(Data[Allowance Type])&&Data[Year of start date]=EARLIER(Data[Year of start date]))),1,0)

Hope this helps.

Untitled.png


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

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors