Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
bentley32
Contributor
Contributor

Formula with 2 calculations from different context

Hello all,

 

I do struggle with a combined formula,

 

when i run it speretaley : 

if('$(=$(vlast_Month))'=M_PEC,Rangeavg(below(Total SUM(IF(M_ENC_SINCE_PEC=1 AND M_SINCE_PEC>1,ENC,0))/SUM(MONTANT),2,6)))

and this one : 

if('$(=$(vlast_Month2))'=M_PEC,sum ( CONFIE_PEC))

Both will work but when i run the in the same formula by multuplying the first one by the second one it wont work,

I know why, since the first one is on a different row (different month) then the second one,

With Tableau i would use windows calculation but i dont know how to fix it in QLik

Thanks for your help

Labels (1)
4 Replies
bentley32
Contributor
Contributor
Author

.

marcus_sommer

If you mean that both calculations work side by side within a single object they should be also work together. But you if mean that it are different objects it won't work. In this case you may consider to force both into a single object - maybe with some aggr() constructs and/or changes to the data-model and/or to the general calculating logic.

bentley32
Contributor
Contributor
Author

the result of the first one is in a row of a dimension (dates) and the result of the second also in the the dates but in a different row

marcus_sommer

Yes, this won't work - both must be on one row. You should consider to remove the date dimension or replacing it with DAY which hasn't a direct relation to month and year and which may enable you to put the results from the current month side by side to previous months.