Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested answer

Current week (entire week) last year formula

(0) ShareShare
ReportReport
Posted on by 15,435

Hi

In analysis view if I want to calculate current week for last year what is the formula? I use CW but it only shows one day  which is 2/5/2023. My goal was to use CW-1Y but this does not work. I thought CW should show 1/30/2023..2/5/2023 but it shows 2/5/2023.

Any help will be greatly appreciate it. 

  • Suggested answer
    Nitin Verma Profile Picture
    21,416 Moderator on at
    RE: Current week (entire week) last year formula

    Hi,

    Did you check as per below code? Not sure if it will work for you.

    CALCDATE('<-1Y>',TODAY)..CALCDATE('<CW-1Y>',TODAY)

    Result - 31/01/22..05/02/22

  • MahGah Profile Picture
    15,435 on at
    RE: Current week (entire week) last year formula

    Thanks Mr Bruvik

    It is totally understandable. I was hoping that CW or etc works and filter for true current week not the end of the current week. But I believe I was wrong and that was not intention of CW.

    I will look into custom code or see if I can find work around

  • Suggested answer
    Inge M. Bruvik Profile Picture
    999 Moderator on at
    RE: Current week (entire week) last year formula

    Yes- what you are trying to do is to combine a date formula and a date filter and that will not work.

    So a date formula field will only let you enter a calc formula. Once you add the .. you indicates that you are working with a filter.

    I don't know if that was understandable.

    So i think you need some custom code to make that work.

  • MahGah Profile Picture
    15,435 on at
    RE: Current week (entire week) last year formula

    Thanks Mr Bruvik 

    I tried that and did not work. See below. the only formula that works is  "-CW-1Y..CW-1Y" but I cannot enter this in Inventory Analysis Template since I get the below error 

    "Validation Results: Your entry of '-CW-1Y..CW-1Y' is not an acceptable value for 'Comparison Date Formula'. The date formula '-CW-1Y..CW-1Y' must include plus (+) or minus (-)."

    Or if enter in Period instead of date 

    "Validation Results -CW-1Y..CW-1Y is not a valid Period Formula." 

    Formula 

    pastedimage1675119281487v1.png

    Result 

    pastedimage1675119300804v2.png

    formula 

    pastedimage1675119319850v3.png

    Result 

    pastedimage1675119332139v4.png

  • Suggested answer
    Inge M. Bruvik Profile Picture
    999 Moderator on at
    RE: Current week (entire week) last year formula

    What if you try CW-52W, does that make a difference?

    If not we could look at using the week number and find the same week number last year. But that takes some more code.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,110 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,886 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans