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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
geogou1973
Creator
Creator

Problem with set analysis

Hello.

I'm facing a problem with set analysis in the following expression.

(sum(SALES_AMT_FPA)-Sum(SALES_QTY*PRICE_LIST))/sum(SALES_AMT_FPA)  in the number a have click the option

Show in Percent (%)

when i give like above the results are correct if i choose the date before udate

how can i have the same results without giving anything with set analysis ?

I have tried this

=SUM({<SALES_DATE={'$(PREVIOUS_UDATE)'},SALES_YEAR=,SALES_MONTH=>} ((SALES_AMT_FPA)-(SALES_QTY*PRICE_LIST))/(SALES_AMT_FPA)) but the results are wrong.

Can anyone help me ?

Thank you in advance.

4 Replies
swuehl
MVP
MVP

It's hard to help without knowing too much about your data model / data / expression context. So, if possible, upload a small sample QVW.

In general, add the set expression to each aggregation function, try like

=(

sum({<SALES_DATE={'$(PREVIOUS_UDATE)'},SALES_YEAR=,SALES_MONTH=>}  SALES_AMT_FPA)

-Sum({<SALES_DATE={'$(PREVIOUS_UDATE)'},SALES_YEAR=,SALES_MONTH=>} SALES_QTY*PRICE_LIST)

)

/

sum({<SALES_DATE={'$(PREVIOUS_UDATE)'},SALES_YEAR=,SALES_MONTH=>} SALES_AMT_FPA)

geogou1973
Creator
Creator
Author

Hello swuehl.

I have also incorrect results with this expression.

henrikalmen
Specialist II
Specialist II

  • Try hardcoding the date in the set expression, ie replace your variable with an actual date
  • Make sure that the variable PREVIOUS_UDATE has the correct format so that it matches the format of SALES_DATE

Any luck?

Not applicable

Try this,


=SUM({<SALES_DATE={"=$(PREVIOUS_UDATE)"},SALES_YEAR=,SALES_MONTH=>} ((SALES_AMT_FPA)-(SALES_QTY*PRICE_LIST))/(SALES_AMT_FPA))


Regards,

Anjali Gupta