web
You’re offline. This is a read only version of the page.
close
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,529

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. 

I have the same question (0)
  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,105 Moderator on at

    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.

  • MahGah Profile Picture
    15,529 on at

    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
    1,105 Moderator on at

    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,529 on at

    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
    Nitin Verma Profile Picture
    21,700 Moderator on at

    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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,151

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,443 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,092 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans