Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers!
Enter the sweepstakes now!Preparing for a certification exam? Ask exam experts all your questions on May 15th. Register now.
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!
Solved! Go to Solution.
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:
result:
This is fantastic, thank you so much!
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:
result:
Check out the April 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
78 | |
76 | |
70 | |
49 | |
42 |
User | Count |
---|---|
62 | |
40 | |
32 | |
30 | |
29 |