Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
aarav021
Contributor III
Contributor III

Can anyone tell me what's wrong in this Qlik Sense expression

Hi I am new to Qlik Sense. Can anyone please help me with currect solution to this as this is an urgent requirement.

LOAD if(Year(max(FISCAL_YEAR))=Year(Today()), Year(max(FINANCIAL_YEAR))) as Curr_FY, if(Year(max(FISCAL_YEAR))=Year(Today()), Year(today()-1)) as Prev_FY Resident [data_table]; Let Current_FY = '=Curr_FY'; Let Last_FY = '=Prev_FY';

 

I want to  create a dynamic variable in load editor for current fiscal year and previous fiscal year. So that I use it in table chart.

Labels (7)
1 Reply
RafaelBarrios
Partner - Specialist
Partner - Specialist

Hi @aarav021 

if your data table has only one single row or you just need one record, you will need to use peek

https://help.qlik.com/es-ES/qlikview/May2021/Subsystems/Client/Content/QV_QlikView/Scripting/InterRe...

your_new_table_name:
LOAD if(Year(max(FISCAL_YEAR))=Year(Today()), Year(max(FINANCIAL_YEAR))) as Curr_FY, if(Year(max(FISCAL_YEAR))=Year(Today()), Year(today()-1)) as Prev_FY Resident [data_table];

let Current_FY = Peek('Curr_FY',0,'your_new_table_name')

 

but if table is bigger or need to read more records, you will need to use a WHILE or FOR to read it

 

Hope this helps.

Best,

help users find answers! Don't forget to mark a solution that worked for you & to smash the like button😁