Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
I'm trying to figure out a way to see if a person we served was, at any point, under the age of 18 during a given time frame....7/1/19 - 6/30/20. Age would be calculated off of a Birthdate field.
Solved! Go to Solution.
Please see full solution below.
Table1 contains two columns, with "Persons Name" and "Birthdate"
WasUnderage:=IF(COUNTROWS(Table1) <> 1, BLANK(),
VAR DateOfBirth = VALUES(Table1[Birthdate])
VAR Date18 = DATE(YEAR(DateOfBirth)+18, MONTH(DateOfBirth), DAY(DateOfBirth))
VAR result = AND(DateOfBirth <= DATE(2020,30,6), Date18 > DATE(2019,7,1))
RETURN
result
)
Hi,
There is a mistake in the order of one of the dates:
Try changing DATE(2020, 30, 6) to DATE(2020, 6, 30)
Please see full solution below.
Table1 contains two columns, with "Persons Name" and "Birthdate"
WasUnderage:=IF(COUNTROWS(Table1) <> 1, BLANK(),
VAR DateOfBirth = VALUES(Table1[Birthdate])
VAR Date18 = DATE(YEAR(DateOfBirth)+18, MONTH(DateOfBirth), DAY(DateOfBirth))
VAR result = AND(DateOfBirth <= DATE(2020,30,6), Date18 > DATE(2019,7,1))
RETURN
result
)
Thank You, I think this is close but I am returning all False values but feel I met the Result...I will keep playing with it
Hi,
There is a mistake in the order of one of the dates:
Try changing DATE(2020, 30, 6) to DATE(2020, 6, 30)
Well you're only interested in the earliest part of the time frame - I don't know where that's coming from and it doesn't really matter, try something like:
18check = var earliesttimeframe = min(however you are defining your time frame)
var whenpersonis18 = dateadd([birthdate],18,year)
return if (earliesttime<whenpersonis18,"was under 18","wasn't under 18")