Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi,
I would like to create a column based on a conditional statement with dynamic dates like this:
if [Date] is the latest date, "Most recent"
if [Date] is the latest date -1 (day), "One day ago"
if [Date] is the latest date -7 (day), "One week ago"
if [Date] is the latest date -1 (month), "One month ago"
if [Date] is the latest date -1 (quarter), "One quarter ago"
if [Date] is the latest date -1 (year), "One year ago"
Thanks!
Solved! Go to Solution.
@AndreeaV , Try a new column like
New column=
Var _max = max(Table[Date]) // or use Today()
return
Switch(True(),
[Date] = _max ,"Most recent",
[Date] = _max-1 , "One day ago",
[Date] = _max -7 , "One week ago",
[Date] = date(year(_max), month(_max) -1, day(_max)), "One month ago",
[Date] = date(year(_max), month(_max) -3, day(_max)), "One quarter ago",
[Date] = date(year(_max)-1, month(_max), day(_max)), "One year ago"
)
@AndreeaV , Try a new column like
New column=
Var _max = max(Table[Date]) // or use Today()
return
Switch(True(),
[Date] = _max ,"Most recent",
[Date] = _max-1 , "One day ago",
[Date] = _max -7 , "One week ago",
[Date] = date(year(_max), month(_max) -1, day(_max)), "One month ago",
[Date] = date(year(_max), month(_max) -3, day(_max)), "One quarter ago",
[Date] = date(year(_max)-1, month(_max), day(_max)), "One year ago"
)
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
58 | |
55 | |
55 | |
38 | |
29 |
User | Count |
---|---|
78 | |
62 | |
45 | |
40 | |
40 |