I have two questions.
Source table contains data at weekly level.
We have a fact table with Week_Key, Month_Key, Quarter_Key (& a beautiful time dimension).
Would it be possible to load-populate Month_Key & Quarter_Key in the
fact table for the source data which is at weekly granularity ?
Problem here would be the last week of the month which falls under
the current month & the next month.
Anyhow if we load weekly data by populating the Month_Key
(considering current month for last week) & so Quarter_Key, would it
be possible to aggreate data Monthly & Weekly seperately at report
level ?
Your thoughts on this would be very helpful ...
If I understand correctly, you have multiple different rollups and you are trying to handle them.
I think the best solution is for the fact table to be at a daily granularity. This is the unit of time that best rolls up into weeks, months, and quarters.
The time dimension would then contain the week, month, and quarter values for all days.
You would then roll-up the data to the appropriate level for reporting purposes. If the data is very voluminous, you may also incorporate summary tables at common levels of aggregation to improve performance for users.
Related
I need to automate a excel table for Time value for Money Calculation to teradata table.
Table structure is like this - it has these columns:
Month Base_Rate 202201 202202 202203 202204.......
and so on
I have attached image of sample data.
Same month is in row and column and I cannot change the structure of data in Excel.
What would be the best way to automate table creation and updating the records each month?
By automate I mean to create reusable script, that can be used every month to update data in table.
There is no definite period when the column gets added, roughly it is done nearly once a year which mean one whole year is added in columns at a time and then the same next year and so on.
And rows are added almost every month which mean for eg. Nov month details are added in Nov
I thought of truncate and load every single month, but this isn't the best option.
I have a measure table for forecast that has a MMM-YY date stored as text;
Period Forecast
-------------------
Jan-20 200
Feb-20 300
I also have some other tables in my model that have similar date formats ie. (1/2020) or 2020_1. Hence I created a date dimension that maps the period to an actual datetime and linked it to the fact table;
Period (Month/Year) Year_Month MonthEnd
---------------------------------------------------
Jan-20 (1/2020) 2020_1 31/01/2020
Feb-20 (2/2020) 2020_2 28/02/2020
This is causing me two issues;
If I slice the forecast by period I get the right answer, but if I slice by the datetime field 'MonthEnd', SSAS can't allocate the costs across the attributes and I get the total each month (so 500 in both jan and feb in this example). Why?
I can't connect time as a referenced dimension to the date dimension so I can't use any time intelligence features.
I could just swap the period ID for a datetime on ETL to standardise the date fields across the model, but I wondered if there was a standard way to approach this?
https://imgur.com/gallery/onxtvhq
In Analysis Services Multidimensional models you need to standardize on one format for representing a period and have all measure groups use that. I would recommend you change the SQL Query for your Actuals measure group to return values that join to the Period column in your Date table.
Understanding how this works means understanding attribute relationships and the IgnoreUnrelatedDimensions setting. If set to true then slicing by an “unrelated” attribute (one that’s below the grain or unrelated or an unrelated dimension) will just cause the measure to repeat. If set to false then it will become null.
I’m unclear why you need Time as a reference dimension. It appears to also contain a Date hierarchy. Typically Date is for days, weeks, months and years. Typically Time is for hours minutes and seconds. For processing performance reasons I would avoid reference dimensions. They are more trouble than they are worth. Add the Time dimension key to your fact tables.
The scrrenshot shows there is relation between Date and Forcast,so I do not think the root cause that is the root casue,however, you can try GreGalloway's solution, to set the property of IgnoreUnrelatedDimensions to False to test.
enter image description here
Background: I have a column in a Customer dimension with a static date(e.g '2013-01-01').
This column is the result of a calculation that gets the first transaction date ever made by that certain customer. This customer dimension is linked to a fact table containing reportdate as a date column linked to a date dimension.
Goal: I want to make a calculated measure that, based on a sum of amount measure, calculates the result based on a given period between start_date(First transaction date), end_date (first transaction date + 6 months).
All i get is "cannot be determined in the current context" warnings and cannot get my head around to fix it.
All help is welcome!
Thanks in advance,
/Blixter
SOLVED I replicated the logic from the calculated measure found in the Customer table.
=CALCULATE([SumAmount];DATESBETWEEN(DimDate[Date];FIRSTDATE(FactTable[Reportdate]);DATEADD(FIRSTDATE(FactTable[Reportdate]);5;MONTH)))
I have a Fact table that holds what are more or less, sales goals. The ETL process that populates it, generates 12 "weighted" values into seperate rows, one per month. Each row however, also includes a field that holds the yearly value. I do this with unpivot. This all works. Now Im trying to get at this data in the cube with an SSRS report. The problem seems to be that I can query and see the results that include either the yearly goal values or the monthly, weighted values, but not both in the same set.
[update for fact table details]
My Fact table looks something like this:
FK_Account
FK_User
Target
Projected
GoalYear
FK_DateKey
FK_Dept
MonthlyWeightedTarget
MonthlyWeightedProjected
When I load this fact table via the ETL, I get the date key associated with each monthly value (MonthlyWeightedTarget). That will be 12 seperate records, but each one will have the same yearly value. Im not including next years value as a seperate column, because there are seperate records already associated with that year.
Basically, the users define a set of goals associated with a given year. Then I am applying a "weighting" to generate 12 seperate "monthly" records, which total up to the yearly target goal. Hope this makes sense.
What I need to see is something like this result:
Account Name
YTDgoal
YearGoal
NextYrGoal
I created a calculated member for the NextYrGoal, but now Im not sure I even need it.
What would be a good approach for handling the above (getting the ytd, yearly and next year values) ?
If I was getting at these values with TSQL, I would sum on the monthly values, and just include the associated yearly and next years values, grouping by account, year-goal, next-year-goal
I've created a new measure which uses [TotalSales] and 'SAMEPERIODLASTYEAR' to calculate the previous year's sales, see below:
=CALCULATE([TotalSales], SAMEPERIODLASTYEAR(Dates[Date]))
This all works fine if I create a pivot that displays individual dates (e.g. 01/01/2015) and then the new measure 'previous year sales' value next to it. My problem occurs when I want to change the pivot and display previous year sales by year, quarter or month - with any of these options I get no sales value.
I'm using a 'Dates' table which is linked to the Sales table.
Am I right in thinking I can re-aggregate sales in this way? I have seen an error message which says something about not been able to aggregate a non-contiguous value or date.
I've had a good look to see if anyone else has experienced the same problem, but can't see anything. Any guidance would be helpful.
Regards,
Martyn
Yes you can re-aggregate in this way. Your formula is correct would handles the changes to the aggregation level.
I would check that your 'Dates' table is marked as a date table. Ensure that the year, quarter & months are in this date table and not in your Sales table. Make sure that your date table has one record for each day between the beginning of your sales data set and the end. Check behavior in Power View if you are using Excel 2013.