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 am trying to create 3 tables in Power Query, each with one value, a variable date.
As an example:
Today is the 7th October 2022
I'm trying to get some M code that gives me the following values autonomously regardless of the currwnt date:
- last day of the previous full month (30th September 2022 in my example)
-last day of the previous financial year (31st March 2022 in my example)
-last day of the full month in the previous full calendar year (30th September 2021 in my example).
It's just the dates I need as I have written DAX that uses them correctly, I'm just trying to stop having to manually type them in.
Many thanks.
Thanks @amitchandak that's amazing.
The third option (Year End) doesn't work for me though. I end up with a Token RightParen expected?
@powerbiuser9999 , Try a column
Last month =
Date.EndOfMonth(Date.AddMonths(Date.From(DateTime.FixedLocalNow()), -1))
Last year same last month=
Date.EndOfMonth(Date.AddMonths(Date.From(DateTime.FixedLocalNow()), -13))
Year End=
let
var _date = Date.From(DateTime.FixedLocalNow())
in
if(Date.Month(_date)<=3, #date(Date.Year(_date) -1, 3, 31), #date(Date.Year(_date) , 3, 31))
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 |
---|---|
57 | |
55 | |
55 | |
37 | |
30 |
User | Count |
---|---|
78 | |
64 | |
45 | |
43 | |
40 |