class DateDimension < ActiveWarehouse::DateDimension
define_hierarchy :anual, [:calendar_year,:calendar_quarter,:calendar_month_name,:calendar_week,:day_in_week]
define_hierarchy :trimestral, [:calendar_quarter,:calendar_month_name,:calendar_week,:day_in_week]
define_hierarchy :mensual, [:calendar_month_name,:calendar_week,:day_in_week]
define_hierarchy :semanal, [:calendar_week]
define_hierarchy :diario, [:day_in_week]
set_order :sql_date_stamp
end
--------------------
then make your fact class,
# model/sales_fact.rb
class SalesFact < ActiveWarehouse::Fact
aggregate :total, :label => "Total", :order => 'Total'
dimension :date
dimension :location
prejoin :date => [:sql_date_stamp]
prejoin :location => [:zip]
end
other dimension classes,
# model/location_dimension.rb
class LocationDimension < ActiveWarehouse::Dimension
define_hierarchy :region, [:region, :state, :zip]
define_hierarchy : zip, [: zip]
end
and cube defioition class
# model/sales_cube.rb
class SalesCube < ActiveWarehouse::Cube
reports_on :robo_negocios
pivots_on :date, :lugar, :robo_negocio
end
in your conrtoller index
<at> report = ActiveWarehouse::Report::TableReport.new
<at> view = <at> report.view(params, options)
and finally in your view
<%= render_report_from( <at> view) %>
and voila,
of course there is much more work than that but it is an approximation, obviously you would have to have data in your database populated that matched the dimension and fact fiels I considered
Cheers
Hope it helps