Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Kenji_Masicat
Contributor III
Contributor III

FY Expression

Hi guys,

What will be the expression if I want to get the FY? May date format is DD/MM/YYYY.

Thanks a lot.

Br,

Kenji

Labels (3)
7 Replies
vikasmahajan

Hi,

Step 1: Create Fiscal year using following script:

https://community.qlik.com/t5/App-Development/Master-Calender/m-p/1883271#M72729

Step 2: Show Sales for current fiscal year

sum(   {<  Fiscalyear =  { "$(=max(FiscalYear)) " }   >}   Sales) 

Previous Year

sum(   {<  Fiscalyear =  { "$(=max(FiscalYear)-1) " }   >}   Sales) 

 

Hope this help you.

Thanks

Vikas

 

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
Kenji_Masicat
Contributor III
Contributor III
Author

Hi Vikasmahajan,

Thanks for the prompt response. The expression computes but it is short of the expectations.

I filtered the year to 2022 and should be getting FY21 results.

 

Kenji_Masicat_0-1645420356450.png

 

Kenji_Masicat
Contributor III
Contributor III
Author

The result is the same for both (previous & current)  expressions. What could be the issue? Thank you

vikasmahajan

Hi,

Please check with date is linked properly :

also refer this link for details set analysis period 

https://community.qlik.com/t5/QlikView-Documents/Date-Level-Analysis-WTD-MTD-QTD-YTD-Current-Year-Pr...

 

Thanks

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
vikasmahajan

can you share sample data

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
anthonyj
Creator III
Creator III

Hi Kenji,

I suspect that you haven't created a FiscalYear column, rather that you are using the native calendar year, so your Max function is only returning the Max calendar year of 2022.
What @vikasmahajan is saying is that once you create a column in the script that is calculated from your date column and returns the fiscal year (eg: Starting in July), you'll be able to use the expression he has supplied above to return those values.

For example:

In your script you create a column using something like below (Assuming the fiscal year begins in July):

Data:

load

  *,

  if(month([Date]) < 7,

  Year([Date])-1,  Year([Date])) as FiscalYear

From YourDataFile.QVD;

This will return a numeric value. Using 28/02/2022 as an example would return: 21

Once the date goes past 01/07/2022 the FiscalYear will return: 22

Assuming you don't have any future dates in your data the Max function currently will return 21 for all records where [Date] is greater than 30/06/2021.

I hope this helps Kenji and that I have assumed your response correctly @vikasmahajan .

Thank you
Anthony

Kenji_Masicat
Contributor III
Contributor III
Author

Thanks a lot @anthonyj and @vikasmahajan . 🙂 I will work on this later and give you feedback. 🙂