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

Need to create new column as Max latest record per employee as one otherwise Zero

Hi All,

Need to create a new column as max latest reocrd per employee as 1 or Zero

if the emp having only one record than its 1

Can anyone help me 

My data looks like 

Emp id dateNew column output 
457/15/20200
459/2/20200
459/4/20201
252/05/20200
258/4/20201
3611/14/20191
3611/1/20190
7511/25/20191
7511/18/20190
488/22/20201
227/22/20201
2 ACCEPTED SOLUTIONS

HI @Venkateswara_ra 

Create a column 

_max = CALCULATE (max(('Table'[Date]),ALLEXCEPT('Table','Table'[EMP ID]))

 

Then use the below

if(CALCULATE(COUNTROWS('Table'),'Table'[Date]=_max)) >0,1,0)





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

View solution in original post

v-easonf-msft
Community Support
Community Support

Hi, @Venkateswara_ra 

Try  to create a   column  to calculated the max date for per employee first:

Max_date = CALCULATE(MAX('Table'[date]),ALLEXCEPT('Table','Table'[Emp id]))

Then create a calculate column as below:

Column = IF('Table'[date]='Table'[Max_date],1,0)

If the date of this record equal Max_date ,the result will show "1"

The result will show as below:

44.png

 

Best Regards,
Community Support Team _ Eason
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

6 REPLIES 6
v-easonf-msft
Community Support
Community Support

Hi, @Venkateswara_ra 

Try  to create a   column  to calculated the max date for per employee first:

Max_date = CALCULATE(MAX('Table'[date]),ALLEXCEPT('Table','Table'[Emp id]))

Then create a calculate column as below:

Column = IF('Table'[date]='Table'[Max_date],1,0)

If the date of this record equal Max_date ,the result will show "1"

The result will show as below:

44.png

 

Best Regards,
Community Support Team _ Eason
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

@Venkateswara_ra , Try as new column

max status

new column = maxx(filter(Table, [Emp id] = earlier([Emp id])),[curretStatus])

 

status on max date

new column = maxx(filter(Table, [Emp id] = earlier([Emp id])),lastnonblankvalue([date],max([curretStatus])))

@amitchandak 

Thanks for reply

Here in the table i need to create currentstatus column as max date per employee as 1 remaining date as zero  

HI @Venkateswara_ra 

Create a column 

_max = CALCULATE (max(('Table'[Date]),ALLEXCEPT('Table','Table'[EMP ID]))

 

Then use the below

if(CALCULATE(COUNTROWS('Table'),'Table'[Date]=_max)) >0,1,0)





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile
pranit828
Community Champion
Community Champion

Hi @Venkateswara_ra 

 

if(CALCULATE (
COUNTROWS('Table'),
FILTER ( ALLEXCEPT('Table','Table'[EMP ID]),'Table'[Date]=MAX([Date]))
) >0,1,0)





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

@pranit828 

Thanks for reply

I tried your logic but its taking max date in the table

but my requriement it needs to take maxdate per employee as 1 others dates of that employee as zero

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.