Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
ali_hijazi
Partner - Master II
Partner - Master II

Help in expression

Hello

Check attached qvw file

I have an expression that is giving correct results:

the expression is in the text object labelled current selection

on the left I have another text object and I want to show the result of 2016 while selecting 2017

but it is giving me zero

please advise

I can walk on water when it freezes
Labels (1)
3 Replies
tresB
Champion III
Champion III

Try:

=sum( {<YEAR={$(=max(YEAR)-1)}>}

  aggr

  (DISTINCT

  sum

  (

  {

  <

  trx_type={'sales_forecast'},

  price_category={'default_product_price'},

  YEAR={$(=max(YEAR)-1)}

  >

  }

   if(trx_date>= from_period and trx_date <= to_period, price_kg)

  )

  ,account_company_key,MONTH_YEAR,customer_key,product_key,account_row_id

  ) )

Capture.PNG

ali_hijazi
Partner - Master II
Partner - Master II
Author

look this doesn't work cause I'm using the expression inside Alt function without sum(aggr(sum....

is there a way to avoid if else and put something in set analysis that gives same result?

I can walk on water when it freezes
ali_hijazi
Partner - Master II
Partner - Master II
Author

yes your suggestion works fine however the complete result is not working well

please refer to the updated document I posted on Help in set analysis current selection and last year (with current selection)

I can walk on water when it freezes