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

Announcements
Save an extra $150 Dec 1–7 with code CYBERWEEK - stackable with early bird savings: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

need formula for tricky output

Dear All,

Need some help Please find the attachment with expected output.

Thanks

16 Replies
kamal_sanguri
Specialist
Specialist

here is the updated one..

I used the expression suggested by settu_periasamy‌..

Anonymous
Not applicable
Author

Hi Settu, settu_periasamy

Your solution is right but when I am using this into main application then it is not showing correct values.

Please see below

Dim used :

1)Division

2)Product

3)State

4)Customer

Expression:

(Sum({$<FinancialYear=,[Posting Date]={">=$(=date(max(YearStart)))<=$(=date(max(YearEnd)))"}>} [Gross Sales Amount])

-

Sum({$<FinancialYear=,[Posting Date]={">=$(=date(max(YearStart)))<=$(=date(max(YearEnd)))"}>} [Sales Return Amount]))/100000

Contr: ?

settu_periasamy
Master III
Master III

Maybe try this..

if(Dimensionality()<=3,

(Sum({$<FinancialYear=,[Posting Date]={">=$(=date(max(YearStart)))<=$(=date(max(YearEnd)))"}>} [Gross Sales Amount]-[Sales Return Amount])/

Sum(TOTAL {$<FinancialYear=,[Posting Date]={">=$(=date(max(YearStart)))<=$(=date(max(YearEnd)))"}>} [Gross Sales Amount]-[Sales Return Amount])),

(Sum({$<FinancialYear=,[Posting Date]={">=$(=date(max(YearStart)))<=$(=date(max(YearEnd)))"}>} [Gross Sales Amount]-[Sales Return Amount])/

Sum(TOTAL <State> {$<FinancialYear=,[Posting Date]={">=$(=date(max(YearStart)))<=$(=date(max(YearEnd)))"}>} [Gross Sales Amount]-[Sales Return Amount])))/100000

Anonymous
Not applicable
Author

Hi settu_periasamy‌,

I tried but not get exp output..

settu_periasamy
Master III
Master III

Have you tried to separate the expression and see the result is correct or not?

Anonymous
Not applicable
Author

Yes

settu_periasamy
Master III
Master III

Hi,

Could you prepare the sample with your issue illustrate?

I believe you are using that expression in pivot table.

May be try this..

if(Dimensionality()<=3,

(Sum({$<FinancialYear=,[Posting Date]={">=$(=date(max(YearStart)))<=$(=date(max(YearEnd)))"}>} [Gross Sales Amount])

- Sum({$<FinancialYear=,[Posting Date]={">=$(=date(max(YearStart)))<=$(=date(max(YearEnd)))"}>}[Sales Return Amount]))/

(Sum(TOTAL {$<FinancialYear=,[Posting Date]={">=$(=date(max(YearStart)))<=$(=date(max(YearEnd)))"}>} [Gross Sales Amount])

-Sum(TOTAL {$<FinancialYear=,[Posting Date]={">=$(=date(max(YearStart)))<=$(=date(max(YearEnd)))"}>} [Sales Return Amount]),

(Sum({$<FinancialYear=,[Posting Date]={">=$(=date(max(YearStart)))<=$(=date(max(YearEnd)))"}>} [Gross Sales Amount])

- Sum({$<FinancialYear=,[Posting Date]={">=$(=date(max(YearStart)))<=$(=date(max(YearEnd)))"}>}[Sales Return Amount]))/

(Sum(TOTAL <State>{$<FinancialYear=,[Posting Date]={">=$(=date(max(YearStart)))<=$(=date(max(YearEnd)))"}>} [Gross Sales Amount])

-Sum(TOTAL <State>{$<FinancialYear=,[Posting Date]={">=$(=date(max(YearStart)))<=$(=date(max(YearEnd)))"}>} [Sales Return Amount])))