Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi all,
Code below which gives me Today's date:
let
Today = Date.From(DateTime.FixedLocalNow()),
YearToday = Text.From(Date.Year(Today)),
MonthToday = "0"&Text.From(Date.Month(Today)),
DayToday = "0"&Text.From(Date.Day(Today)),
CreateTextForQueryEnd = Text.End(DayToday,2) &"/"& Text.End(MonthToday,2) &"/"& YearToday
in
CreateTextForQueryEnd
But I want to get the LAST 15th of a month.
Example:
Thanks for your help.
Solved! Go to Solution.
@mb0307
i missed that point: Try this oneplease.
let
Today = #date(2020, 1, 14),//Date.From(DateTime.FixedLocalNow()),
PreMonth15 = Date.AddDays(Date.StartOfMonth( Date.AddMonths(Today,if Date.Day(Today) > 15 then 0 else -1)),14)
in
PreMonth15
________________________
If my answer was helpful, please click Accept it as the solution to help other members find it useful
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@mb0307
Yes, it should, try the following code, you can change the YY, MM,DD to test
let
Today = #date(2020,01,31), //Date.From(DateTime.FixedLocalNow()),
PreMonth15 = Date.AddDays(Date.StartOfMonth( Date.AddMonths(Today,-1)),14)
in
PreMonth15
________________________
If my answer was helpful, please click Accept it as the solution to help other members find it useful
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@Fowmy not giving the correct result. Please see example below.
on 16th Dec, it should show LAST 15th i.e. 15th Dec
Similarly
Example:
@mb0307
i missed that point: Try this oneplease.
let
Today = #date(2020, 1, 14),//Date.From(DateTime.FixedLocalNow()),
PreMonth15 = Date.AddDays(Date.StartOfMonth( Date.AddMonths(Today,if Date.Day(Today) > 15 then 0 else -1)),14)
in
PreMonth15
________________________
If my answer was helpful, please click Accept it as the solution to help other members find it useful
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@mb0307
Check this code:
let
Today = Date.From(DateTime.FixedLocalNow()),
PreMonth15 = Date.AddDays(Date.StartOfMonth( Date.AddMonths(Today,-1)),14)
in
PreMonth15
________________________
If my answer was helpful, please click Accept it as the solution to help other members find it useful
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@Fowmy Thanks.
it worked and given me 15th Nov. But will it work once current date is >= 15th Dec (for that it should give me 15th Dc)?
Thanks
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.