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!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi there ;
i have a calculation on power quaery side with a M formula
it works like that ; i have date column and i am creating status column based on that dates.
Rule :
if the date's month before the current month status = Previous Month
İf the date's month is in current month status =Actual Month
İf the dates's month is after current month status = Next Month
So all dates before the current month are Previous and all dates after the current month are Next Month , all the dates in current month are Actual Month
i am using below formula on power Query side and i need this formula on power query side :
Custom = if Date.EndOfMonth([File Date]) = Date.EndOfMonth(Date.From(DateTime.FixedLocalNow())) then "Actual Month" else if Date.EndOfMonth([File Date]) <= Date.AddMonths( Date.EndOfMonth(Date.From(DateTime.FixedLocalNow())),-1) then "Previous Month" else if Date.EndOfMonth([File Date]) >= Date.AddMonths( Date.EndOfMonth(Date.From(DateTime.FixedLocalNow())),+1) then "Next Month" else null
but as you see below when i use like that formula for august month system gives "null" , how can i solve this problem could you check pls
Solved! Go to Solution.
@erhan_79 , seems fine try like
Custom = if Date.EndOfMonth([File Date]) = Date.EndOfMonth(Date.From(DateTime.FixedLocalNow())) then "Actual Month"
else if Date.EndOfMonth([File Date]) <= Date.EndOfMonth(Date.AddMonths( Date.From(DateTime.FixedLocalNow()),-1)) then "Previous Month" else if Date.EndOfMonth([File Date]) >= Date.AddMonths( Date.EndOfMonth(Date.From(DateTime.FixedLocalNow())),+1) then "Next Month" else null
@erhan_79 , seems fine try like
Custom = if Date.EndOfMonth([File Date]) = Date.EndOfMonth(Date.From(DateTime.FixedLocalNow())) then "Actual Month"
else if Date.EndOfMonth([File Date]) <= Date.EndOfMonth(Date.AddMonths( Date.From(DateTime.FixedLocalNow()),-1)) then "Previous Month" else if Date.EndOfMonth([File Date]) >= Date.AddMonths( Date.EndOfMonth(Date.From(DateTime.FixedLocalNow())),+1) then "Next Month" else null
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.