I have a fact_purchases table and a dim_customer table in a star schema. I want to build a pentaho report that takes a start and end date as a parameter and then returns all customers who purchased more than one item during the time period. If a customer purchased less than two items during that time period, they should be excluded from the report.
I am using a metadata backed query in report designer. For selected columns, I have the customer's email and the purchase date. For customer email, I set an aggregation of "count". Now I want to do the metadata equivalent to the sql WHERE count(*) > 1. In the metadata conditions, I added one condition with the following:
Combine - Not
Aggregation - Count
Column - Email
Comparison - exactly matches
Value - 1
Note - The dropdown for "Comparison" did not have an option for greater than. I'm guessing that it is looking at the metadata for email address (which is set to string) and only offering string related options.
When I run my report, it returns users who only purchased one item. How do I exclude these users from the report using a metadata based query? The SQL that I'm trying to emulate is:
How would I emulate this logic in a metadata based pentaho query? Thanks.
I am using a metadata backed query in report designer. For selected columns, I have the customer's email and the purchase date. For customer email, I set an aggregation of "count". Now I want to do the metadata equivalent to the sql WHERE count(*) > 1. In the metadata conditions, I added one condition with the following:
Combine - Not
Aggregation - Count
Column - Email
Comparison - exactly matches
Value - 1
Note - The dropdown for "Comparison" did not have an option for greater than. I'm guessing that it is looking at the metadata for email address (which is set to string) and only offering string related options.
When I run my report, it returns users who only purchased one item. How do I exclude these users from the report using a metadata based query? The SQL that I'm trying to emulate is:
Code:
SELECT customerId
FROM fact_purchases
WHERE
purchaseDate > #startDate#
AND purchaseDate < #endDate#
GROUP by customerId
HAVING COUNT(customerId) > 1