cancel
Showing results for
Did you mean:

## Lable YTD Rows in Calendar

I'm trying to create a way to label all YTD comparable rows in a calendar table.  I got close but it doesn't handle leap years (see screenshot)

Can anyone assist in a proper formula that would return true for all YTD dates of prior years?  For example, today I should see True on all rows for January 1-June 6th of all years.

Current attempt is an attempt to convert the row's day to the same day this year and then check if that's in current YTD:

= Table.AddColumn(#"Calculated Quarter", "YOY YTD", each Date.IsInYearToDate( #date(Date.Year(DateTime.Date(DateTime.LocalNow())),Date.Month([Date]), Date.Day([Date]))) )

1 ACCEPTED SOLUTION

Accepted Solutions

ShawnKeeneTF

The formula will return true for each of those dates.

Regards

The following M code generates all dates from 1st Jan 2020 to 31st Dec 2023 and uses the formula to mark each date as in YTD or not so you can check if it does what you want. The screenshot in your question was not readable so maybe there's some other subtlety in the question that it would reveal.

`letSource = List.Dates(#date(2020,1,1), Duration.TotalDays(#date(2023,12,31) - #date(2020,1,1)) + 1 , #duration(1,0,0,0)),#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),#"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type date}}),#"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Column1", "Date"}}),#"Add in Year" = Table.AddColumn(   #"Renamed Columns",    "Error Free Version",    each Date.IsInYearToDate(    Date.AddYears( [Date], Date.Year(DateTime.LocalNow()) - Date.Year([Date]) )   ),   type logical   )in#"Add in Year"`

4 REPLIES 4

Good day ShawnKeeneTF,

An idea would be to use AddYears to add years to “Date”. AddYears takes care of leap years sensibly.

1. The number of years to add is year(this year)-year(date).
2. Then check if that date is in the current year to date.

Here is M code, with the formula which gives the error and then the formula using AddYears.

Hope this helps.

`let   Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtc30zcyUIrViVYystQ3grENDUDixkqxsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t]),   #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}}),   #"Added Error Version" = Table.AddColumn(      #"Changed Type",       "Errored Version",       each Date.IsInYearToDate(          #date(Date.Year(DateTime.Date(DateTime.LocalNow())),Date.Month([Date]), Date.Day([Date]))      ),       type logical   ),   #"Added Error-free Version" = Table.AddColumn(      #"Added Error Version",       "Error Free Version",       each Date.IsInYearToDate(          Date.AddYears( [Date], Date.Year(DateTime.LocalNow()) - Date.Year([Date]) )      ),      type logical)in   #"Added Error-free Version"`

which gives the result

I found something like this online but I don't think this is exactly what I'm after. I'll give it a try though.

The problem is that I want for example June 1st to show up as true for all years. Basically all dates that are within the completed days this year.

So all these should be true for example

June 1 2020

June 1 2021

June 1 2022

June 1 2023

ShawnKeeneTF

The formula will return true for each of those dates.

Regards

The following M code generates all dates from 1st Jan 2020 to 31st Dec 2023 and uses the formula to mark each date as in YTD or not so you can check if it does what you want. The screenshot in your question was not readable so maybe there's some other subtlety in the question that it would reveal.

`letSource = List.Dates(#date(2020,1,1), Duration.TotalDays(#date(2023,12,31) - #date(2020,1,1)) + 1 , #duration(1,0,0,0)),#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),#"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type date}}),#"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Column1", "Date"}}),#"Add in Year" = Table.AddColumn(   #"Renamed Columns",    "Error Free Version",    each Date.IsInYearToDate(    Date.AddYears( [Date], Date.Year(DateTime.LocalNow()) - Date.Year([Date]) )   ),   type logical   )in#"Add in Year"`

Thanks, I see the offset you're using that makes this work when the earlier examples I had seen online didn't account for all years.  Thank you so much for this.

Announcements

#### December 2023 User Group Update: Welcoming New Groups and Upcoming Events

A new month means it's time to celebrate and welcome the new user groups that have joined our community. We are excited to announce that we have more than 8 New Groups, which is no surprise after the amazing Microsoft Power Platform Conference. This month, we are breaking them out by the different community categories. If your group is listed here, give this post a kudo so we can celebrate with you! Don't forget to take a look at the many events happening near you or virtually! It's a great time of year to connect and engage with User Groups both locally and online.   Please Welcome Our NEW User Groups   Power Platform: PowerIT User Group: Nottingham Power Platform User Group: Bergen Power Platform User Group: Danmark Nashville Power Platform User Group Microsoft Ambassador Program y Mujer Latina Technolochicas NCWIT Community Copilot Studio:  Copilot User Group Italia Dynamics365: Dynamics User Group AdriaticDynamic 365 Azerbaijan   December User Group Events   01 Dec 2023 Aprendiendo Desarrollo web, creando mi primer power app y power page. 01 Dec 2023 Q4 Hybrid Philadelphia Dynamics 365 & Power Platform User Group Meeting05 Dec 2023APAC Dynamics 365 FastTrack Bootcamp - BI and Analytics07 Dec 2023Bay Area Power Platform Meetup: Learn, Share, and Connect07 Dec 2023Indiana D365/AX December User Group Meeting07 Dec 2023Dynamics User Group Meeting: Houston09 Dec 2023 December '23 - NEW Power Apps User Group Meeting - Online 12 Dec 2023December Cleveland Power Platform User Group Meeting12 Dec 2023 RW2 Data Stewardship Open Forum Discussion 13 Dec 2023  Black Country Power Platform User Group - December 2023 - West Midlands

#### Back to Basics: All Ten Tuesday Tips

Welcome to our November Newsletter, where we highlight the latest news, product releases, upcoming events, and the amazing work of our outstanding Community members. If you're new to the Community, please make sure to follow the latest News & Announcements and check out the Community on LinkedIn as well! It's the best way to stay up-to-date with all the news from across the Power Platform and beyond.        This month's highlights:- - Our most active community members- Microsoft Power Up Program- Microsoft Community Days website - The latest blogs and more                 COMMUNITY HIGHLIGHTS Check out the most active community members of the last month. These hardworking members are posting regularly, answering questions, kudos, and providing top solutions in their communities. We are so thankful for each of you--keep up the great work! If you hope to see your name here next month, just get active! FLMikePstork1Nived_NambiarWarrenBelzSprongYeManishSolankiLaurensMwskinnermlcAgniusExpiscornovuscreativeopinion KatieAUinzil2kHaressh2728hafizsultan242douicmccaughanwoLucas001domliu   Power Up Program Click the image below to discover more about the amazing Microsoft Power Up Program, as Reem Omar, Abbas Godhrawala, Chahine Atallah, Ruby Ruiz Brown, Juan Francisco Sánchez Enciso, Joscelyne Andrade Arévalo, Eric G. and Paulina Pałczyńska share how non-tech professionals can successfully advance into a new career path using Microsoft #PowerPlatform.   To find out more about this amazing initiative, click here to apply for the program and reboot your journey into low-code app development today!     Community Days - Event Website Have you checked out the Community Days website yet? Dedicated to the volunteer community organizers around the world, Community Days is the perfect place to find an event near you or add an event for wider exposure. Many thanks to Thomas Daly, Sharon Weaver, Sedat Tum, Jonathan Weaver, Manpreet Singh, David Leveille, Jason Rivera, Mike Maadarani, Rob Windsor and the team for all their hard work. Anyone can host a Community Day on any topic relevant to our industry, just click the image below to find out more.       EVENT NEWS Power Platform French Summit - Paris/Virtual - 6-7th Dec It's not long now until the Power Platform French Summit, which takes place both virtually and in-person at the Microsoft France conference center in Paris on 6-7th December 2023. If you can't make it in-person, all sessions will also be broadcast on virtual networks for better distribution and accessibility.   There's a fantastic array of speakers, including Jérémy LAPLAINE, Amira Beldjilali, Rémi Chambard, Erika Beaumier, Makenson Frena, Assia Boutera, Elliott Pierret, Clothilde Facon, Gilles Pommier, Marie Aubert, Antoine Herbosa, Chloé Moreau, Raphaël Senis, Rym Ben Hamida, Loïc Cimon, Joséphine Salafia, David Zoonekyndt, Aïcha Charpentier, Henry Jammes, Milene Rochard, Mehdi EL YASSIR, and many more. Click the image below for more information.       LATEST COMMUNITY BLOG ARTICLES Power Apps Community Blog Power Automate Community Blog Copilot Community Blog Power Pages Community Blog

#### Unlocking the Power of Community: A Journey with Featured User Group leaders Geetha Sivasailam and Ben McMann

In the bustling world of technology, two dynamic leaders, Geetha Sivasailam and Ben McMann, have been at the forefront, steering the ship of the Dallas Fort Worth Power Platform User Group since its inception in February 2019. As Practice Lead (Power Platform | Fusion Dev) at Lantern, Geetha brings a wealth of consulting experience, while Ben, a key member of the Studio Leadership team at Lantern, specializes in crafting strategies that leverage Microsoft digital technologies to transform business models.   Empowering Through Community Leadership Geetha and Ben's journey as user group leaders began with a simple yet powerful goal: to create a space where individuals across the DFW area could connect, grow their skills, and add value to their businesses through the Power Platform. The platform, known for its versatility, allows users to achieve more with less code and foster creativity.   The Power of Community Impact Reflecting on their experiences, Geetha and Ben emphasize the profound impact that community engagement has had on both their professional and personal lives. The Power Platform community, they note, is a wellspring of resources and opportunities, fostering continuous learning, skill enhancement, and networking with industry experts and peers.   Favorite Moments and Words of Wisdom The duo's favorite aspect of leading the user group lies in witnessing the transformative projects and innovations community members create with the Power Platform. Their advice to aspiring user group leaders? "Encourage diverse perspectives, maintain an open space for idea-sharing, stay curious, and, most importantly, have fun building a vibrant community."   Building Bridges, Breaking Barriers Geetha and Ben encourage others to step into the realm of user group leadership, citing the rewarding experience of creating and nurturing a community of like-minded individuals. They highlight the chance to influence, impact, and positively guide others, fostering connections that extend beyond mere technology discussions.   Joining a User Group: A Gateway to Growth The leaders stress the importance of joining a user group, emphasizing exposure to diverse perspectives, solutions, and career growth opportunities within the Power Platform community. "Being part of such a group provides a supportive environment for seeking advice, sharing experiences, and navigating challenges."   A Year of Milestones Looking back at the past year, Geetha and Ben express pride in the group's growth and global participation. They recount the enriching experience of meeting members in person at the Microsoft Power Platform conference, showcasing the diverse range of perspectives and guest speakers that enriched the community's overall experience.   Continuous Learning on the Leadership Journey As user group leaders, Geetha and Ben recognize the continuous learning curve, blending interpersonal skills, adaptability, and dedication to foster a vibrant community. They highlight the importance of patience, persistence, and flexibility in achieving group goals, noting the significance of listening to the needs and suggestions of group members.They invite all tech enthusiasts to join the Dallas Fort Worth Power Platform User Group, a thriving hub where the power of community propels individuals to new heights in the dynamic realm of technology.

#### Microsoft Ignite 2023: The Recap

What an amazing event we had this year, as Microsoft showcased the latest advancements in how AI has the potential to reshape how customers, partners and developers strategize the future of work. Check out below some of our handpicked videos and Ignite announcements to see how Microsoft is driving real change for users and businesses across the globe.   Video Highlights Click the image below to check out a selection of Ignite 2023 videos, including the "Microsoft Cloud in the era of AI" keynote from Scott Guthrie, Charles Lamanna, Arun Ulag, Sarah Bird, Rani Borkar, Eric Boyd, Erin Chapple, Ali Ghodsi, and Seth Juarez. There's also a great breakdown of the amazing Microsoft Copilot Studio with Omar Aftab, Gary Pretty, and Kendra Springer, plus exciting sessions from Rajesh Jha, Jared Spataro, Ryan Jones, Zohar Raz, and many more.     Blog Announcements Microsoft Copilot presents an opportunity to reimagine the way we work—turning natural language into the most powerful productivity tool on the planet. With AI, organizations can unearth value in data across productivity tools like business applications and Microsoft 365. Click the link below to find out more.     Check out the latest features in Microsoft Power Apps that will help developers create AI-infused apps faster, give administrators more control over managing thousands of Microsoft Power Platform makers at scale, and deliver better experiences to users around the world. Click the image below to find out more.     Click below to discover new ways to orchestrate business processes across your organization with Copilot in Power Automate. With its user-friendly interface that offers hundreds of prebuilt drag-and-drop actions, more customers have been able to benefit from the power of automation.     Discover how Microsoft Power Platform and Microsoft Dataverse are activating the strength of your enterprise data using AI, the announcement of “plugins for Microsoft Copilot for Microsoft 365”, plus two new Power Apps creator experiences using Excel and natural language.       Click below to find out more about the general availability of Microsoft Fabric and the public preview of Copilot in Microsoft Fabric. With the launch of these next-generation analytics tools, you can empower your data teams to easily scale the demand on your growing business.     And for the rest of all the good stuff, click the link below to visit the Microsoft Ignite 2023 "Book of News", with over ONE HUNDRED announcements across infrastructure, data, security, new tools, AI, and everything else in-between!

Top Solution Authors
Top Kudoed Authors
Users online (2,986)