Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Sam_Thomas
Creator
Creator

Expression tweaking

Hi

I have an expression that seems to be working just fine, where I determine the "Application Rate" for a number of sites. 

The expression is below:

=240/

(Avg(if(FullName='% Nitrogen',

if([SludgeSampleDate]>=today()-365, [DeterminandValue])) * 10)

*

(Avg(if(FullName='Dry Solids',

if([SludgeSampleDate]>=today()-365, DeterminandValue))) /100))

 

(As I say, this calculation is returning correct values - but may not be the most efficient way.)

 

This calculation gives me the rate based on sample results taken in the last year. I would like to add another column which tells me what the application rate was last year. So rather than using all samples from today - 365, I would like to use all data from samples between -730 and -365. 

 

How might I do this? Thank you in advance.

Labels (1)
2 Solutions

Accepted Solutions
justISO
Specialist
Specialist

Hi, just edit part

[SludgeSampleDate]>=today()-365

to

[SludgeSampleDate]<today()-365 and [SludgeSampleDate]>=today()-730

View solution in original post

Sam_Thomas
Creator
Creator
Author

I tried that, but it didn't work. Then I pasted yours and realised I was a bracket out! Thanks a lot. 

View solution in original post

2 Replies
justISO
Specialist
Specialist

Hi, just edit part

[SludgeSampleDate]>=today()-365

to

[SludgeSampleDate]<today()-365 and [SludgeSampleDate]>=today()-730

Sam_Thomas
Creator
Creator
Author

I tried that, but it didn't work. Then I pasted yours and realised I was a bracket out! Thanks a lot.