title: How to use Django Subquery inside Annotate and Sum
body: <p>I am trying to calculate total revenue for a day. Each DailyTotal contains a count of items sold (items_sold) and a Price those items were sold that day (items_price) (every items is sold for the same price all day). That part is working, but now I need to convert multiply that value by the exchange rate for that day/country.</p>
  
  <pre><code>rate = ExchangeRate.objects.filter(  
      date=OuterRef('date'), 
      country=OuterRef('country')))  
  
  calc_with_rate = Sum(F('items_sold') * F('items_price') * Subquery(rate.values('rate')), output_field=FloatField(),)  
  
  results = DailyTotal.objects.filter(**query_filters).annotate(
      revenue=calc_with_rate)
  </code></pre>
  
  <p>but I get:</p>
  
  <pre><code>unsupported operand type(s) for +=: 'int' and 'NoneType
  </code></pre>
  
  <p>I assume it is because rate.values('rate') is not returning a an int..
  but I can't do </p>
  
  <pre><code>rate.values('rate')[0]
  </code></pre>
  
  <p>or I get:</p>
  
  <pre><code>This queryset contains a reference to an outer query and may only be used in a subquery.
  </code></pre>
  
  <p>so I am not sure how to complete this query?</p>