Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
AdrianoEllero
Contributor III
Contributor III

how to get the Period selected on a dimension field or the fiscal period based on current date

I have to calculate the projection of a measure for the entire fiscal year.
Typically the formula is:
=Revenew_fiscal_year_2024 / 8 * 12

while 12 can be a constant as the 12th month of the fiscal year
the current fiscal period (8) changes depending on the day of the month.

is there any way to deduct the fiscal period knowing the current date?

thanks 

 

1 Solution

Accepted Solutions
AdrianoEllero
Contributor III
Contributor III
Author

at the end it worked like that, supposing first month of fiscal year is October:

=if(
    Month(Today())<10,
    Revenew_fiscal_year / (Month(Today())+2) * 12,
    Revenew_fiscal_year / (Month(Today())-9) * 12

View solution in original post

5 Replies
TauseefKhan
Creator III
Creator III



Hi @AdrianoEllero 

You can use the following approach:

LET vToday = Today();
LET vFiscalYearStartMonth = 4; // Assuming fiscal year starts in April

// Calculate the current fiscal period
LET vCurrentFiscalPeriod = Month(vToday) - vFiscalYearStartMonth + 1;
IF vCurrentFiscalPeriod <= 0 THEN
LET vCurrentFiscalPeriod = vCurrentFiscalPeriod + 12;
ENDIF

// Now use this variable in your expression
RevenueProjection = (Revenew_fiscal_year_2024 / $(vCurrentFiscalPeriod)) * 12;


***Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.***

AdrianoEllero
Contributor III
Contributor III
Author

I have error at the first row.

LET vToday = Today();

AdrianoEllero_0-1717777156704.png

any hint?

TauseefKhan
Creator III
Creator III

Check this one:
LET vToday = num(today(1))

There is no error on my side.

TauseefKhan_0-1717778143523.png

 

AdrianoEllero
Contributor III
Contributor III
Author

no way
I am editing the expression in a chart

what ever I write in the expression automatically appear with "=" in front

this works for example
Month(Toda()) that becomes = Month(Toda())

 

even other formulas work like Turnover/(Month(Toda()) + 2) * 12 that becomes =Turnover/(Month(Toda()) + 2) * 12

I can't write LET

AdrianoEllero
Contributor III
Contributor III
Author

at the end it worked like that, supposing first month of fiscal year is October:

=if(
    Month(Today())<10,
    Revenew_fiscal_year / (Month(Today())+2) * 12,
    Revenew_fiscal_year / (Month(Today())-9) * 12