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! Request now

Reply
HankScorpio2
Helper I
Helper I

Create New Column with True False outcome based on date and id

Hi 

 

I have a few years worth of consultant metric data. I want to create a custom column that is based on the lowest date of the first occurrence of a consultant id and mark New in the column for the first 10 weeks. And for all other dates past that occurrence for that id mark No. 

 

Something like this but for every id across all the years. From the first date the id occurs until 7 weeks later. I tried it in excel but it only does it for the first 70 days and ignores all new ids after that time. 

 

=LET(AgentStartDate, MIN(FILTER([Interval Start], [Agent Id] =[Agent Id])), IF([@[Interval Start]] <= AgentStartDate + 70, "New", "No"))

 

Interval StartAgent IdAnsweredTotal HandleTotal TalkTotal HoldTotal ACWNew Starter
13/05/20219c9f586a-ca35-4445-acfb-27f54bea5b0159421955942219111153400000New
14/05/20219c9f586a-ca35-4445-acfb-27f54bea5b0178350234351966814285273403000New
17/05/20219c9f586a-ca35-4445-acfb-27f54bea5b011920776445779616265482966435000New
18/05/20219c9f586a-ca35-4445-acfb-27f54bea5b012018153014899091738301065335000New
19/05/20219c9f586a-ca35-4445-acfb-27f54bea5b013220314041845787348936046967000New
20/05/20219c9f586a-ca35-4445-acfb-27f54bea5b0129223767361173281934339967216000New
21/05/20219c9f586a-ca35-4445-acfb-27f54bea5b012818093604783743339395166320000New
24/05/20219c9f586a-ca35-4445-acfb-27f54bea5b0135230296791117950743606757495000New
26/05/20219c9f586a-ca35-4445-acfb-27f54bea5b012719802255863521433586657812000New
27/05/20219c9f586a-ca35-4445-acfb-27f54bea5b012716110715779181528813835443000New
28/05/20219c9f586a-ca35-4445-acfb-27f54bea5b012517046237795542839695235126000New
31/05/20219c9f586a-ca35-4445-acfb-27f54bea5b012413956113593930923867765631000New
2/07/2021 0:009c9f586a-ca35-4445-acfb-27f54bea5b012016275640644173658061124030000New
12/07/2021 0:009c9f586a-ca35-4445-acfb-27f54bea5b012113127777521983934755074436000New
13/07/2021 0:009c9f586a-ca35-4445-acfb-27f54bea5b012115663483698796136394965040000New
14/07/2021 0:009c9f586a-ca35-4445-acfb-27f54bea5b012111925114470295532210294003000New
15/07/2021 0:009c9f586a-ca35-4445-acfb-27f54bea5b01324822111155997538214788000New
16/07/2021 0:009c9f586a-ca35-4445-acfb-27f54bea5b01146793727418914874845000New
19/07/2021 0:009c9f586a-ca35-4445-acfb-27f54bea5b015351950510530488857361581000New
21/07/2021 0:009c9f586a-ca35-4445-acfb-27f54bea5b0196581368333642519817541264000New
22/07/2021 0:009c9f586a-ca35-4445-acfb-27f54bea5b012212216844605865132879042873000New
23/07/2021 0:009c9f586a-ca35-4445-acfb-27f54bea5b012416827237886092429222795047000No
26/07/2021 0:009c9f586a-ca35-4445-acfb-27f54bea5b012517377667868152041313024568000No
27/07/2021 0:009c9f586a-ca35-4445-acfb-27f54bea5b011612937312518244446088063147000No
28/07/2021 0:009c9f586a-ca35-4445-acfb-27f54bea5b01422772631188650472865616000No
1 ACCEPTED SOLUTION
wdx223_Daniel
Super User
Super User

M Code:

NewStep=let a=Table.Group(YourSourceName,"Agent Id",{"MinDate",each List.Min([Interval Start])}) in Table.AddColumn(YourSourceName,"New Starter", each if [Interval Start]<=a{[#"Agent Id"=[Agent Id]]}[Interval Start]+#duration(70,0,0,0) then "New" else "No")

 

DAX Code:

NewCalculatedColumn=VAR _mindate=CALCULATE(MIN(YourTable[Interval Start]),ALLEXCEPT(YourTable,YourTable[Agent Id])) RETURN IF(YourTable[Interval Start]<=_mindate+70,"New","No")

View solution in original post

3 REPLIES 3
v-veshwara-msft
Community Support
Community Support

Hi @HankScorpio2 ,

Thanks for reaching out to Microsoft Fabric Community.

Just wanted to check if the response provided by @wdx223_Daniel  helped address your requirement. If you still need any further assistance, please let us know.

Thank you @wdx223_Daniel  and @lbendlin for your inputs on this thread.

wdx223_Daniel
Super User
Super User

M Code:

NewStep=let a=Table.Group(YourSourceName,"Agent Id",{"MinDate",each List.Min([Interval Start])}) in Table.AddColumn(YourSourceName,"New Starter", each if [Interval Start]<=a{[#"Agent Id"=[Agent Id]]}[Interval Start]+#duration(70,0,0,0) then "New" else "No")

 

DAX Code:

NewCalculatedColumn=VAR _mindate=CALCULATE(MIN(YourTable[Interval Start]),ALLEXCEPT(YourTable,YourTable[Agent Id])) RETURN IF(YourTable[Interval Start]<=_mindate+70,"New","No")

lbendlin
Super User
Super User

You seem to be mixing M and DAX code. Please specify if you want this column to be added in Power Query or in Power BI

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

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!

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.