cancel
Showing results for
Did you mean:
Highlighted
Member

Re: calculation number of day till today

Thank you @SPG this work fine

but can we make as fiscal month start as our month start on 26-8  so i should have 22 day  not 17 day

```Days Since First Day of Month =
VAR firstDayOfCurrentMonth = DATE(YEAR(TODAY()); MONTH(TODAY()); 1)
RETURN
DATEDIFF(firstDayOfCurrentMonth; TODAY(); DAY) + 1```

Member

Re: calculation number of day till today

There may be better ways to do it, but I didn't have much time now and I wanted to keep the "step by step" logic to make you understand it better.

```Days Since First Day of Fiscal Month =
VAR currentYear = YEAR(TODAY())
VAR currentMonth = MONTH(TODAY())
VAR currentDay = DAY(TODAY())
VAR firstDayOfFiscalMonth = 26
VAR
fiscalMonth =
IF(
currentDay >= firstDayOfFiscalMonth;
currentMonth;
MONTH(EOMONTH(TODAY(); -1))
)
VAR
fiscalYear =
IF(
currentMonth = 1 && currentDay < firstDayOfFiscalMonth;
currentYear - 1;
currentYear
)
RETURN
DATEDIFF(DATE(fiscalYear; fiscalMonth; firstDayOfFiscalMonth); TODAY(); DAY) + 1```