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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
LilMurph
Frequent Visitor

Check if a value appears earlier in a column

Hi All

I have a table where one column specifies the week as 1, 2, 3 etc. Another column specifies a job by specific code i.e. ABC-123, ABC-578, CCA-246 etc. 

I want to create a new column which states that a job is new if the code does not occur in the first week. Does anyone have any advice on how to do this as I am drawing a blank.

Thanks

LilMurph

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@LilMurph , first week or last week

 

A new column =

var _cnt = countx(filter(Table, [Job] =earlier([Job]) && [Week] =1 ), [Job])

return

if(isblank(_cnt), "New", "Old")

 

based on last week

 

A new column =

var _cnt = countx(filter(Table, [Job] =earlier([Job]) && [Week] =earlier([Week])  -1 ), [Job])

return

if(isblank(_cnt), "New", "Old")

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @LilMurph ,

 

May I ask if your problem has been solved? Did amitchandak's post above help you? If any of the posts are helpful, then please consider accepting it as a solution to help other members find it faster. Many thanks!

 

If this doesn't work for you, would you mind providing some data that does not contain private information?

It makes it easier to give you a solution.

  1. Sample (dummy dataset) data as text, use the table tool in the editing bar
  2. Expected output from sample data
  3. Explanation in words of how to get from 1. to 2.

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

amitchandak
Super User
Super User

@LilMurph , first week or last week

 

A new column =

var _cnt = countx(filter(Table, [Job] =earlier([Job]) && [Week] =1 ), [Job])

return

if(isblank(_cnt), "New", "Old")

 

based on last week

 

A new column =

var _cnt = countx(filter(Table, [Job] =earlier([Job]) && [Week] =earlier([Week])  -1 ), [Job])

return

if(isblank(_cnt), "New", "Old")

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.