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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Recurring Events

Hello, 

I have this table of static dates that are recurring year by year. I want to show these dates in a calender visual but I want to only display the current year, since these dates are recurring yearly I would like to make a measure which replaces the year in this table to the current year of viewing. Also if there is a flag I can create to show when the current date is beyond a deadline date that would be amazing, basically just compare todays date to the date in the table and Flag if it is Future, Past or Present. 

Thanks for your help!

LiamNeufeld_0-1717002002615.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

you should be able to paste this into powerquery the only thing you need to change is #"Changed Type" to whatever the previous step in your table is called

CurrentYear = Date.Year(DateTime.LocalNow()),
CurrentDate = DateTime.Date(DateTime.LocalNow()),
TransformDate = Table.TransformColumns(#"Changed Type",{{"Dates", each #date(CurrentYear, Date.Month(_), Date.Day(_)), type date}}),
AddStatusColumn = Table.AddColumn(TransformDate, "Status", each if [Dates] < CurrentDate then "Past" else if [Dates] = CurrentDate then "Present" else "Future")
in
    AddStatusColumn

 if you need help getting it to work respond with the tailend of your current code in powerquery and I'll help you out.

 

I did test the code out and it worked

Starting Data:

Corey_M_0-1717009541834.png

result:

Corey_M_2-1717009612825.png

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

This is fantastic, thank you so much!

 

Anonymous
Not applicable

you should be able to paste this into powerquery the only thing you need to change is #"Changed Type" to whatever the previous step in your table is called

CurrentYear = Date.Year(DateTime.LocalNow()),
CurrentDate = DateTime.Date(DateTime.LocalNow()),
TransformDate = Table.TransformColumns(#"Changed Type",{{"Dates", each #date(CurrentYear, Date.Month(_), Date.Day(_)), type date}}),
AddStatusColumn = Table.AddColumn(TransformDate, "Status", each if [Dates] < CurrentDate then "Past" else if [Dates] = CurrentDate then "Present" else "Future")
in
    AddStatusColumn

 if you need help getting it to work respond with the tailend of your current code in powerquery and I'll help you out.

 

I did test the code out and it worked

Starting Data:

Corey_M_0-1717009541834.png

result:

Corey_M_2-1717009612825.png

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.

Top Solution Authors