• Eirikur Eiriksson (11/19/2016)


    Can you post the DDL (creat table) script for the SUMMARY and the JASPER_REBATES_SUMMARY tables, the full code of the stored procesure and the actual execution plan please?

    😎

    I'd be curious to the grain of these 2 tables as well. Given your WHERE clauses like:

    WHERE MEASURE_NAME='PRICE PROTECTION'

    AND @Measures = 'AVERAGE PRICE '

    AND @Time_Scale = 'MONTH'

    It looks like there is multiple grains within the same SUMMARY table, creating a Centipede fact table?

    http://www.kimballgroup.com/data-warehouse-business-intelligence-resources/kimball-techniques/dimensional-modeling-techniques/centipede-fact-table/

    If you're using something like Analysis Services on top of these tables, it might be better to utilize hierarchies within that to summarize data:

    https://msdn.microsoft.com/en-us/library/hh231692.aspx