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: 
gayatri7
Creator II
Creator II

Facing Issue with If Condition

Hi All,

I need help with below expression

If(GetFieldSelections([Account Level 1])='FTE'

,If(GetFieldSelections([Account Level 1])='FTE' and Year <> vLastProcessedYearY

  ,SUM({<[Month Name]=,Month_Code={'12'},Version_Group_Name=>}Amount_m_USD)

  ,If(GetFieldSelections([Account Level 1])='FTE' and Year = vLastProcessedYearY and Version_Group_Name='PY Actual'

  ,SUM({<[Month Name]=, Year= {'$(vLastProcessedYearPrevY)'}, Version_Group_Name={'Actual'},Month_Code={'12'}>}Amount_m_USD)

   ,SUM({<[Month Name]=,Version_Group_Name=>}Amount_m_USD))))

 

With Selection Y2020, FTE

 

PY Table.PNG

I am getting 0 for PY Actual

 

But When I am using the expression (Partial) in Text box, With selection as PY Actual, I am getting correct value.

 

If(GetFieldSelections([Account Level 1])='FTE' and Year = vLastProcessedYearY and Version_Group_Name='PY Actual'

  ,SUM({<[Month Name]=, Year= {'$(vLastProcessedYearPrevY)'}, Version_Group_Name={'Actual'},Month_Code={'12'}>}Amount_m_USD)

  ,SUM({<[Month Name]=>}Amount_m_USD))

PY TextBox.PNG

 

 

 

 

Could you please help, what am I missing. I want this PY Value to my table.

 

 

2 Replies
gayatri7
Creator II
Creator II
Author

I tried below expression as well

 

If(GetFieldSelections([Account Level 1])='FTE' and Year <> vLastProcessedYearY
,SUM({<[Month Name]=,Month_Code={'12'},Version_Group_Name=>}Amount_m_USD)
,If(GetFieldSelections([Account Level 1])='FTE' and Year = vLastProcessedYearY and Version_Group_Name='PY Actual'
,SUM({<[Month Name]=, Year= {'$(vLastProcessedYearPrevY)'}, Version_Group_Name={'Actual'},Month_Code={'12'}>}Amount_m_USD)
,SUM({<[Month Name]=,Version_Group_Name=>}Amount_m_USD)))

 

Still same result.

lorenzoconforti
Specialist II
Specialist II

A bit hard to help without seeing the dashbaord (maybe post it); try wrapping it into an aggr:

 

=sum(agg(If(GetFieldSelections([Account Level 1])='FTE'

,If(GetFieldSelections([Account Level 1])='FTE' and Year <> vLastProcessedYearY

  ,SUM({<[Month Name]=,Month_Code={'12'},Version_Group_Name=>}Amount_m_USD)

  ,If(GetFieldSelections([Account Level 1])='FTE' and Year = vLastProcessedYearY and Version_Group_Name='PY Actual'

  ,SUM({<[Month Name]=, Year= {'$(vLastProcessedYearPrevY)'}, Version_Group_Name={'Actual'},Month_Code={'12'}>}Amount_m_USD)

   ,SUM({<[Month Name]=,Version_Group_Name=>}Amount_m_USD)))),  [Version_Group_Name]))