I have a table where I want to filter information in power query as per a date column (Start Date) in the table when are meeting the following criteria:
I cannot use (group by) and load the maximum values (latest) because I do have future year values.
Please find attached excel sheet data source file (click here), you can check my draft PBI file (click here)
Solved! Go to Solution.
I was just thinking this might be better:
let
_TwoMonthsAgo = Date.StartOfMonth(Date.AddMonths(DateTime.FixedLocalNow(), -2)),
_SixMonthsAhead = Date.EndOfMonth(Date.AddMonths(DateTime.FixedLocalNow(), 6)),
_FilterDate = Table.SelectRows(YOURTABLE, each [Start Date] >= _TwoMonthsAgo and [Start Date] <= _SixMonthsAhead)
in
_FilterDate
Hi, @2019 , you might want to try adding a customed column in PQ,
#"Added Custom" =
let
Today = DateTime.Date(DateTime.LocalNow()),
Days_Till_Next_6_Months = Duration.Days(Date.AddMonths(Today,6)-Today)
in
Table.AddColumn(
#"Replaced Value1",
"Criteria", each
if Date.IsInCurrentMonth([Start Date]) then "Current Month" else if Date.IsInPreviousMonth([Start Date]) then "Last 2 Months" else let Diff = Duration.Days([Start Date]-Today) in if Diff>0 and Diff<=Days_Till_Next_6_Months then "Next 6 Months" else "Other"
)
Here is the pbix file for your reference.
Thank you @CNENFRNL for providing assistant to accomplish this, I have tried your approach but I have found out the below:
1. Last 2 months:
For the last 2 months you are using this code Date.IsInPreviousMonth([Start Date]) will return back the last 1 month info instead of 2 month info,
For example, when I filter the Criteria column to last 2 months I only see Jan-2021 info and there are no info for Dec-2020
Is there away where I can filter as per the last N months (N is where I specify number of months).
2. Next 6 Months:
I have tried your approach but I have found out if I filter the Criteria column to Next 6 Months,
For Aug-2021 it shows me only 4 rows instead of total 16 rows
Is there a way to accomplish that?
Try this (or something like it, I'm writing it this off the top of my head, so the syntax might be wrong.)
let
_CurrentMonthStart = Date.StartOfMonth(DateTime.FixedLocalNow()),
_CurrentMonthEnd = Date.EndOfMonth(DateTime.FixedLocalNow()),
_TwoMonthsAgo = Date.AddMonths(_CurrentMonthStart, -2),
_SixMonthsAhead = Date.AddMonths(_CurrentMonthEnd, 6),
_FilterDate = Table.SelectRows(_YOURTABLE, each [Start Date] >= _TwoMonthsAgo and [Start Date] <= _SixMonthsAhead)
in
_FilterDate
I was just thinking this might be better:
let
_TwoMonthsAgo = Date.StartOfMonth(Date.AddMonths(DateTime.FixedLocalNow(), -2)),
_SixMonthsAhead = Date.EndOfMonth(Date.AddMonths(DateTime.FixedLocalNow(), 6)),
_FilterDate = Table.SelectRows(YOURTABLE, each [Start Date] >= _TwoMonthsAgo and [Start Date] <= _SixMonthsAhead)
in
_FilterDate
let
Origine = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("fV1bjx03jv4rizOv6QNdS1WPne62247j+JKN7QzmwTMIBov1zgbGehf2r98qkRI/Siy/Gc0jlS68fqTov/718uaa8nL54RKWm+dfPt34df/3vSvL5W8/7MQv17iEg3rz88evN34jYm7EsMT9L/6gfu7UjahXv8Rvx9B88/aPP4n6+MI71wb7uP59/1t0+4f/RfSn0W2NnPZf7nPjh1cee83eHzOXm/s//jGvytUl+3Rz++fnm5D3f7/6+Pk/eWj0Cy3ZIO4fXY6J/XLz5I+/3wSnvnosqZ4UbTd48zCWm5f//b/zmng3rlLrxPoslkr2dVVtcOElu2WlRR275UU14r7bdPy81BW3Q1z7vOlYZaRzWocT9nXkfk4m1W31oNTY/dgbNdc1rWrBud18Oc41y0ngvLEcI8N288s//mc+p1jn3XkCqX2vof7Fb3Q9Sd+sS8cffCYi307qE2+RFows0044xlIX/Pzjv/oBy5Lobs6YbQ0iAhM/hXj8PjiZeT+Kvp2UCq0Jv9upfi3MqV/+OW12WY9zSlU6pq+6uuJISxqZ2FU2ZeFwg7T7cFz6Rgsap43LMmxGK4pj3pO9xC3UjyJRJL1K875RoMp6Yz3gYFKvqSRiUtgq3txxgsHL0McXm3w2ORKrer4jNa4sdIdyGpa8659MxEOzDZu9LnU7G13NNG3hM+wfxZOIJZKWwHk34X5fT7irEFiR81F06cxKlW1jFaphSddQCohNGLXLSgzRFwQjXU5f9YJEznfO92xVjrMfp/UL2xxQ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oDlwXI9EaTbRSxA+zbeaWuoclevwntrq5H73hrZLJXzITCjYkdGyufEn0zlexXULsMKFTggbLurjRSvRPWziSgX+AUOWKGXiPyyYnlFapV1l0KZB+e/bNlrIxslvhNObZQ44uv2AUXo8mqx+UAZhEl5/I6attZYMFx19MNwVZIUawKDMOV6sXr/H2pMx6OQm8Sf/O0BsPS/nMORNa5sSHbIjj33P585SYhiaXWdzwtRQ9wy3+WzpL+5/1PT5SKRy7Ww7Lq0JuPF/LPBTOm8I13vUSFonZvUDegaDfKAn2EilGz/Yr+r6F3KhN9tH4ca83uDyN63VCT8/nKg+18dgRbm7MnYjENKASr5wXxL0lKdLhmcBeu72g9ZHd/YouD1H44LhRviRbVQHBh7BdpEU4aBHuZWQ4oL+wFAaio/fpHtotSjzYKJ7g8UUndQN8okic6L6lF5Fcj2nUxkNcgmSI+MKp/SNpPaMntjRQl2r6PnSAW2TDtnQmYsjvNQz/HDAAqehjjNToAdBS1Jqyp6XCiO5C+tE9fUvUfm0UH6BgNOE2WXyZ+d4j8/CzwY7I73X8p/Q46RRFJnahhgnvXvTrNiNhNuuXkuT2TGoaRBxQ/8HYlpXzr10qk76uOb7zPcgAUDI1mHz215L3JspY3PUNzz5CZ6Zs1+I/OJoLhHjINn4P308PobFIEspxd3rDDBGXWBvm3u9fWj/25Nch3RIffp7/cuqhjbi7e+Z02wztZbE39/+fJ2kDnLr3F86BMVIgL5wJfOcxqhURhcQegB4M3H3HzNPQV2ICxKh7DXAA6fRS/bcYAplXUrYuaHGnGZu3fs20zUgjBeVj+rqxfICMYfyyzetBlT+aW2dw/8cPaH3gAMErxi7AOPz87VTMr1zwftTZOxDqeikCcj3T0p0FD3Q+FM6QUhD1PG3/wc=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Item = _t, #"Start Date" = _t, Asset = _t]),
#"Modificato tipo" = Table.TransformColumnTypes(Origine,{{"Item", type text}, {"Start Date", type date}, {"Asset", type text}}, "en-US"),
#"Ordinate righe" = Table.Sort(#"Modificato tipo",{{"Start Date", Order.Ascending}}),
#"Raggruppate righe" = Table.Group(#"Ordinate righe", {"Start Date"}, {{"all", each _},{"quanti", each Table.RowCount(_)}},GroupKind.Local,(x,y)=>Date.Month(x[Start Date])-Date.Month(y[Start Date])),
#"Aggiunta colonna personalizzata" = Table.AddColumn(#"Raggruppate righe", "lastNmonths", each LCN([Start Date],2,6))
in
#"Aggiunta colonna personalizzata"
where LCN is:
let
lastNCurrNextM=(d,n,m) =>
let
curr=Date.From(Date.StartOfMonth( DateTime.LocalNow())),
lastN=Date.AddMonths(curr,-n),
nextM=Date.AddMonths(curr,+m+1),
md=Date.StartOfMonth(d),
res=if md < lastN then "too past" else
if md <curr then "lastN" else
if md=curr then "current" else
if md <nextM then "nextm" else "too future"
in
res
in lastNCurrNextM
I used your method and it succeeded 100%, Thank you so much and also to the others who provided their solutions.
I have made minor changes to the code and I used power query formatter to make it look like this:
#"FilterDate" =
let
_Last2Months = Date.StartOfMonth(Date.AddMonths(DateTime.Date(DateTime.FixedLocalNow()), - 2)),
_Next6Months = Date.EndOfMonth(Date.AddMonths(DateTime.Date(DateTime.FixedLocalNow()), 6))
in
Table.SelectRows(
#"Replaced Value1",
each [Start Date] >= _Last2Months and [Start Date] <= _Next6Months
)
Awesome! I'm glad it worked for you!
You can use the isinprevious and isinthenext date/tiem filter options when select the dropdown from the column you want to filter
example below
Table.SelectRows(FilterFiles, each Date.IsInPreviousNMonths([Date created], 2))
Dear Community Members, We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd. During this period, members will not be able to Kudo, Comment, or Reply to any posts. On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities. What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!
We are excited to announce the Summer of Solutions Challenge! This challenge is kicking off on Monday, June 17th and will run for (4) weeks. The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions in the Forums to as many questions as you can. Answers can be provided in all the communities. Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”) - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024 Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods. You must enter into each weekly Entry Period separately. How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different. Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers. At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing. Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner. A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random. Individuals will be contacted before the announcement with the opportunity to claim or deny the prize. Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners. Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event. ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE** Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersNumber of SolutionsSuper UsersNumber of Solutions @anandm08 23 @WarrenBelz 31 @DBO_DV 10 @Amik 19 AmínAA 6 @mmbr1606 12 @rzuber 4 @happyume 7 @Giraldoj 3@ANB 6 (tie) @SpongYe 6 (tie) Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersSolutionsSuper UsersSolutions @anandm08 10@WarrenBelz 25 @DBO_DV 6@mmbr1606 14 @AmínAA 4 @Amik 12 @royg 3 @ANB 10 @AllanDeCastro 2 @SunilPashikanti 5 @Michaelfp 2 @FLMike 5 @eduardo_izzo 2 Meekou 2 @rzuber 2 @Velegandla 2 @PowerPlatform-P 2 @Micaiah 2 Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Apps anandm0861WarrenBelz86DBO_DV25Amik66Michaelfp13mmbr160647Giraldoj13FLMike31AmínAA13SpongYe27 Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Apps DBO-DV21WarranBelz26Giraldoj7mmbr160618Muzammmil_0695067Amik14samfawzi_acml6FLMike12tzuber6ANB8 SunilPashikanti8
On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners. The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights. Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.
We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for. We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer. Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together. Here's to new beginnings and endless possibilities! If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport. To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages