Calculating the Last Day of each Month

  • Last update:  2023-09-26
  • Overview

    Preview

    You may need to extract the data of the last day of each month, such as the last day of the month in which the Payment Time falls, as shown in the following figure.

    iconNote:
    The example in this document does not involve operations on the hour-minute-second data. To extract the year-month-day data, you can use the LEFT function to extract the first 10 characters of each field.

    1.png

    Implementation Method

    Use the DATE function in combination with YEAR, MONTH, and other functions to obtain the last day of each month.

    Procedures

    Sample data: Contract Payment Facts Table.xlsx

    Creating an Analysis Subject

    Create an analysis subject and upload the sample data.

    2.png

    Calculating the Last Day of Each Month

    Click Formula Column and name the added column as Last Day of Each Month. Enter the formula DATE(YEAR(Payment Time),MONTH(Payment Time)+1,1)-1 and click OK.

    3.png

    iconNote:
    You can select the fields you need from the left area or enter the first few letters and select the one you need in the pop-up list. Fields in black entered manually do not take effect.

    Formula explanation:

    Formula
    Explanation

    YEAR(Payment Time)

    Return the year of the payment time.

    MONTH(Payment Time)+1

    Return the month after the month of the payment time.

    DATE(YEAR(payment time),MONTH(payment time)+1,1)

    Return the first day of the month after the month of the payment time.

    DATE(YEAR(payment time),MONTH(payment time)+1,1)-1

    Return the last day of the month of the payment time.

    After you calculate the last day of each month, you can click Save All and Update or perform further calculations.

    Demonstration

    For the demonstration of this KPI card, see the second figure in section "Preview".

    Notes

    To calculate the last day of the current month, you can use the TODAY function and the DAYSOFMONTH function with the formula DATE(YEAR(TODAY()),MONTH(TODAY()),DAYSOFMONTH(TODAY())).

    4.png

    Formula explanation:

    Formula
    Explanation

    YEAR(TODAY())

    Return the year of the current date.

    MONTH(TODAY())

    Return the month of the current date.

    DAYSOFMONTH(TODAY())

    Return the number of days of the current month.

    DATE(YEAR(TODAY()),MONTH(TODAY()),DAYSOFMONTH(TODAY()))

    Return the last day of the current month.


    附件列表


    主题: Adding and Editing Data
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy