I am using direct query to connect to my dimension and fact table.
I have 1 fact table and 2 dimension tables and need a way to sum (1) in each column for each month between a beginning and end date contained in the fact table.
This is an example of the fact table:
[cust key] [plan key] [beginning date key] [ending date key]
123 10 20160701 20161231
456 10 20140101 20991231
789 15 20160101 20160630
012 15 20150715 20171231
345 20 20160315 20160930
This is an example of what I need from the fact table:
[cust] [plan] [jan 16] [feb 16] [mar 16] [apr 16] [may 16] [jun 16] [jul 16] [aug 16] [sep 16] [oct 16] [nov 16] [dec 16] [total]
123 10 1 1 1 1 1 1 6
456 10 1 1 1 1 1 1 1 1 1 1 1 1 12
789 15 1 1
012 15 1 1 1 1 1 1 1 1 1 1 1 1 12
345 20 1 1 1 1 1 1 1 7
2 2 3 3 3 4 4 4 4 3 3 3 38
I need the report to show a one in each month even though I don't have a count in each month plus it needs to be able to calculate under all critera pulls.
Thank you in advance for any help on this.