Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
I have the following formula:
CurrentYear = var _a = YEAR(TODAY())
return IF(WEEKNUM(TODAY(),21)>10 && YEAR(TODAY())=_a-1, IF(MAX('RegionsTableFull'[LoadingYearC])=_a-1, 1, 0),
IF(WEEKNUM(TODAY(),21)>=4 && WEEKNUM(TODAY(),21)<10,
IF(MAX('RegionsTableFull'[LoadingYearC])=_a, 1, 0),
IF(WEEKNUM(TODAY(),21)<=3, IF(MAX('RegionsTableFull'[LoadingYearC])=_a, 1, 3))))
Everything was working fine yesterday going into the WEEKNUM(TODAY())>10. But now, when it is 02.01.2023 and my IF goes to the last part <=3 I always get the FALSE result of 3 instead of 1. I have absolutely no idea where the issue might be here, because apparently I satisfy the condition for week number, but I never satisfy the condition for MAX LoadingYearC=_a.
As you can see in the image I have data that has 2023 in LoadingYearC and YEAR(TODAY()) is in fact 2023.
What is the problem here?
@GeorgiGeorgiev4 , Try this
Switch( True() ,
WEEKNUM(TODAY(),21)<=3 && MAX('RegionsTableFull'[LoadingYearC])=_a, 1,
WEEKNUM(TODAY(),21)<=3 ,3 ,
WEEKNUM(TODAY(),21)<10 && MAX('RegionsTableFull'[LoadingYearC])=_a , 1 ,
WEEKNUM(TODAY(),21)<10 , 0,
YEAR(TODAY())=_a-1 && MAX('RegionsTableFull'[LoadingYearC])=_a-1 , 1 ,
0)
Hello @amitchandak ,
Thank you for the quick reply!
Literally 3 minutes ago my code magically started working for some god-unknown reason without me doing anything. If it breaks again I will try your code, because I am afraid if I touch it again what might happen.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.