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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Hayleysea
Resolver II
Resolver II

New row indicator against specific past date

Hi There,

 

I need a calculated column that indicates whether an ID is new when comparing to other date with a key indicator as per the example below:

 

IDDateKey IndicatorResult
A1/03/202010
B1/03/202010
A2/03/2020 0
B2/03/2020 0
A3/03/2020 0
B3/03/2020 0
C3/03/2020 1

 

Key indicator is against 1/03/2020 so this is what I want to compare to.

I want to compare the latest day (3/03/2020) with the day that has the key indicator (1/03/2020) and produce a 1 in the result column if it is in fact a new ID that's been created since the last date with the key indicator, otherwise a 0.

 

Any help greatly appreciated!!

1 ACCEPTED SOLUTION
Hayleysea
Resolver II
Resolver II

I figured it out using some of what @amitchandak said and making some changes.

Ended up with a calculated column like this:

 

Calculated Column=
var keyindicatordate = CALCULATE(MAX(table[Date]), FILTER(table, table[keyindicator]="1"))
var maxdate= CALCULATE(MAX(table[Date]), FILTER(table, Table[ID]=EARLIER(table[ID])))
return IF(CALCULATE(DISTINCTCOUNT(table[ID]), FILTER(table, table[Date]=keyindicatordate && table[ID]=EARLIER(table[ID])))-CALCULATE(DISTINCTCOUNT(table[ID]), FILTER(table, table[Date]=maxdate && table[ID]=EARLIER(table[ID])))<0 && table[max week calculated column]=1,1,0)

View solution in original post

3 REPLIES 3
Hayleysea
Resolver II
Resolver II

I figured it out using some of what @amitchandak said and making some changes.

Ended up with a calculated column like this:

 

Calculated Column=
var keyindicatordate = CALCULATE(MAX(table[Date]), FILTER(table, table[keyindicator]="1"))
var maxdate= CALCULATE(MAX(table[Date]), FILTER(table, Table[ID]=EARLIER(table[ID])))
return IF(CALCULATE(DISTINCTCOUNT(table[ID]), FILTER(table, table[Date]=keyindicatordate && table[ID]=EARLIER(table[ID])))-CALCULATE(DISTINCTCOUNT(table[ID]), FILTER(table, table[Date]=maxdate && table[ID]=EARLIER(table[ID])))<0 && table[max week calculated column]=1,1,0)

@Hayleysea, I suggested a Measure

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
amitchandak
Super User
Super User

You will not able to change the date in case you use a calculated column. try like a measure

measure =
var _max = maxx('Table','Date'[Date])
var _min = Minx('Table','Date'[Date])

return
if(CALCULATE(distinctCOUNT('Table'[ID]), FILTER(all('Table'), 'Table'[Date]=_max)) - CALCULATE(distinctCOUNT('Table'[ID]), FILTER(all('Table'), 'Table'[Date]=_min)) >=0,1, 0)
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
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.