Hi,
I wrote a very specific SQL query that also includes specific binning, I also need a City filter to work on this query before adding it to the dashboard. However, when I added the filter query it showed me this message (No Result). No matter what I do to my query it refuses to show me any result with the filter on.
Here is the code:
SELECT
FLOOR("source"."budget per person per month" / 100) * 100 AS bin_start,
FLOOR("source"."budget per person per month" / 100) * 100 + 9 AS bin_end,
COUNT(*) AS bin_count,
AVG("source"."budget per person per month") AS avg_budget_per_person
FROM (
SELECT
"public"."seeker_profile"."property_id" AS "property_id",
"public"."seeker_profile"."min_rooms" AS "min_rooms",
"public"."seeker_profile"."max_budget" AS "max_budget",
CAST("public"."seeker_profile"."max_budget" AS float) / NULLIF("public"."seeker_profile"."min_rooms", 0) AS "budget per person per month",
"Property Contract"."monthly_rent_per_person" AS "Property Contract__monthly_rent_per_person",
"Property Location"."property_id" AS "Property Location__property_id",
"Property Location"."city" AS "city"
FROM "public"."seeker_profile"
LEFT JOIN "public"."property_contract" AS "Property Contract" ON "public"."seeker_profile"."property_id" = "Property Contract"."property_id"
LEFT JOIN "public"."property_location" AS "Property Location" ON "public"."seeker_profile"."property_id" = "Property Location"."property_id"
) AS "source"
WHERE "source"."budget per person per month" BETWEEN 100 AND 3000
AND ("source"."city" = '{{city}}' OR '{{city}}' = '')
GROUP BY FLOOR("source"."budget per person per month" / 100), "source"."property_id"
ORDER BY bin_start;