Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have a real-estate dataframe with several features( square_feet, Number_of_rooms,Number_of_garages,Sale_Price...) and I would like to compare the Saleprice to the average saleprice of similar houses.
That is, select a range of square_feet, Number_of_rooms, Number_of_garages and evaluate :
x = 100*(Sale_Price-Avg(Sale_Price[selection])/(Avg(Sale_Price[selection])))
I would like to display this value in a table with the other features displayed as well.
For now I managed to evaluate my expression with the global average, independant of the selection, and can't figure out what to change.
The context you are trying to create your expression for is important.
If you want to use the expression in a chart with Houses as dimension (and potentially your other features like square feet), you would probably need to use the TOTAL qualifier (or a TOTAL qualifier with field list) to disregard the dimensions:
= 100*(Only( Sale_Price)-Avg(TOTAL Sale_Price) )/(Avg(TOTAL Sale_Price)
If this doesn't help, then it might be helpful if you can post a small sample QVW or some sample records and your expected result.
Try this may be:
100 * (Avg({1}Sale_Price)-Avg({$} Sale_Price))/Avg({$} Sale_Price)
Where Avg({1}Sale_Price) won't change based on selection, but Avg({$} Sale_Price) will.
Note: You can use Avg(Sale_Price) in place of Avg({$} Sale_price) because when nothing is specified, the default is $
The context you are trying to create your expression for is important.
If you want to use the expression in a chart with Houses as dimension (and potentially your other features like square feet), you would probably need to use the TOTAL qualifier (or a TOTAL qualifier with field list) to disregard the dimensions:
= 100*(Only( Sale_Price)-Avg(TOTAL Sale_Price) )/(Avg(TOTAL Sale_Price)
If this doesn't help, then it might be helpful if you can post a small sample QVW or some sample records and your expected result.
thank you, the TOTAL do the trick.