Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

set analysis based on intersecting events

Hi, I'm having trouble figuring out how to write this as set analysis in an expression:

=AVE( [Cost of Car]/[Price of Car])

Where....

[Cost of Car] is >0

AND

[Price of Car} is not NULL

I'm trying to get to the average (percent) of cost divided by price - where the cost is greater than $0, and the field that contains the price is not empty.

Any ideas?  Thanks.

1 Solution

Accepted Solutions
Gysbert_Wassenaar

avg({<[Cost of Car]={">0"},[Price of Car]={'*'}>} [Cost of Car]/[Price of Car])


talk is cheap, supply exceeds demand

View solution in original post

3 Replies
Gysbert_Wassenaar

avg({<[Cost of Car]={">0"},[Price of Car]={'*'}>} [Cost of Car]/[Price of Car])


talk is cheap, supply exceeds demand
sunny_talwar

Or this:

=Avg({<[Cost of Car]={">0"}, [Price of Car] = {"=Len(Trim([Price of Car])) > 0"}>}[Cost of Car]/[Price of Car])

Not applicable
Author

Thanks; I had that but wasn't getting the right answer.  Turns out I had duplicate VINs where both cars had a price, but only one had a cost which was giving me an answer that was half of what it should have been.