I'm completely new to Looker Studio so apologies if this is a simple question. I've spent some looking for an answer but not found anything yet.
What I am trying to do is divide revenue by the number of queries received. For example:
Revenue = £5000 Total Queries = 5 Revenue per query = £1000`
The 'Total Queries' field I have is already a calculated field, counting up two different types of queries.
My formula so far is: Revenue / Total Queries
But unfortunately this is multiplying rather than dividing. If it was the example above I would get a figure of £50,000.
I have tried adding SUM() in a variety of places, but I just can't get the correct figure.
Can anyone kindly assist? Many thanks in advance.
try the following approch
Revenue / (Total Queries * 1.0)
this is probably happening because looker studio treats integer division differently from floating-point division here by multiplying by 1.0 converts the integer division to floating-point division.
additionally if the above approch did not work .
dimension: revenue {
type: number
sql: ${TABLE}.revenue ;;
}
dimension: total_queries {
type: number
sql: ${TABLE}.total_queries ;;
}
measure: revenue_per_query {
type: number
sql: ${revenue} / ${total_queries} ;;
}
it will ensure that all are the number type ,also it is a better way to handle.