Can we do a year on year comparison using the dimension input in an expression? This is what I am trying to do. My dimension is Year and in the expression I want to show the total sales (e.g) for the selected dimension as that of the previous year?
It should look something like this:
Year Current sale Last year
2013 1000 1500
2012 1500 1200
2011 1200 1100
Is this doable or is it something I have to accommodate for in the data modelling layer?
If you're using straight table, you need to accommodate this on your data model layer, but if you're using this with another dimension, and only showing single year, you can use set analysis:
Current Year Expression: SUM({$<Year={$(=MAX(Year))}>}Sales)
Last Year Expression: SUM({$<Year={$(=MAX(Year)-1)}>}Sales)
Related
I am trying to create a calculated column on a SSAS cube to work out the following:
Net Net X Rate = [Net Net Revenue] / [X]
where X = no of days
I need an output for X (using MDX), Something like the no. of days for the date period selected
For example upon the selection of
30 days for the chosen month of April 2021
X = 30
rate for 30 days
14 days for the chosen month of December 2020
X=14
rate for 14 days
I don't have access to SSAS at this point, but maybe somthing like
Net Net X Rate = [Net Net Revenue] / COUNT( EXISTING [Date].[Calendar].[Day].Members )
Answered here maybe: Count children members in MDX
Maybe this could help: DateDiffDays or .
I had something like this in mind: DateDiffDays([Measures].[From_Date], Now()). It will count the days difference between some day in the past and now. DateDiffWorkdays will get you a number of working days between two dates.
Alternatively, you could pre-calculate this value in a view and then pull the number into a cube.
Assuming your Date dimension is on day granularity, a very efficient way from query performance point of view to get what you want would be to add a column to your date dimension table. This could either be done in a view in the relational data model, or in the DVS as a calculated column. Name it e. g. number of days or just X, and make it be the value 1 on each row, i. e. the column expression is just 1. Then you create a new measure group based on this table, with the only measure being X, which would just sum this column. Then, whatever your query context would be, the X measure would just be the number of days. If you want, you can then make the measure invisible.
I have been given population data like this;
Year Region Population
----------------------------------
2012 District1 1000
2012 District2 1500
2012 District3 2000
Now I have to make a cube where a user can filter population in Month, Quarter and Year level. So I decided to enter data into a fact table with each and every month of the given year that means 12 records for each District with the same given number. So if a user asks for any month he will get the same count. But now the problem is if user does not filter it by Month, Quarter and Year I get the Sum of all the data that means District1 will display 12 times 1000 = 12000. How can I get 1000 for district1 at any given time? If data is in multiple years then also it should not sum them up. Is my approach wrong? Hope I am clear enough to explain the problem.
Your fact is a semi additive measure, more info at http://msdn.microsoft.com/en-us/library/ms175356.aspx
I have a table with more than 20000 rows, In one of column i have month from jan 2014 to Dec 2014, and in another column i have a loan number. Most of the loan Numbers are reapeting every months,now i need to get only the loan Number which are apperead in all three monthy consecutively. For eg if i am getting data for current months i also wanted get data which are common in two months before the current months. The database that i m using is Access DB. Any adivice will be more than a help, Thanks in Advance.
SELECT Loans.LoanID, Sum(IIf([period]=[month],1,0)) AS CM, Sum(IIf([period]=[month]-1,1,0)) AS [m-1], Sum(IIf([period]=[month]-2,1,0)) AS [m-2]
FROM Loans
GROUP BY Loans.LoanID
HAVING (((Sum(IIf([period]=[month],1,0)))>1) AND ((Sum(IIf([period]=[month]-1,1,0)))>1) AND ((Sum(IIf([period]=[month]-2,1,0)))>1));
I used month as an integer, and didn't make any adjustment for months 1 and 2 to loop back and look at prior year - you should be able to modify this based on the actual format you are using for the month.
I have a dimension with the following levels:
Years
Months
Days
I want to get some data by months regardless of the year, i.e. weddings in January.
If I have:
January 2011 - 43
January 2012 - 20
January 2013 - 30
What I want is:
January - 93
Is it possible?
Thanks
Edit:
I have tried this query (with sales, no weddings):
WITH member [Time].[example] AS 'AGGREGATE({[Time].[Months].[Jan]})'
SELECT
NON EMPTY {Hierarchize({[Measures].[Sales]})} ON COLUMNS,
NON EMPTY {[Time].[example]} ON ROWS
FROM [SteelWheelsSales]
but I only get the first January.
Yes, this depends on how you structured your calendar dimension. In this case, you would have a month string field, and it would have
January
February
... So on... Note that the month string field, does not have the year included.
This field would be aggregatable set in the SSAS dimension. When creating your MDX query you would put month on rows, and weddings on columns. Using this approach you should get your desired result.
So doing the following should get you all January sales :
SELECT
NON EMPTY {[Measures].[Sales]} ON COLUMNS,
NON EMPTY {[Time].[Year] * [Time].[Jan]} ON ROWS
FROM [SteelWheelsSales]
I am novice with SSRS.
I have a report which should display 60 months (5 years displayed like Jan 1999, feb 1999 & so on till the end of 60 months) and its corresponding sales amount. I want to get averages for the first 12 months (i.e for the 1st year) and so on. Is it possible? My dataset just gives me all the 60 months row-by-row.I am using matrix for my report.
Thanks,
User007.
I would add some nested row grouping to the matrix. The higher-level group would be by year, which would allow you to have a row in the matrix that totals/averages all of the data for the year. The inner group would be by month, giving you the individual month rows as your dataset returns them.
Here is some information about defining and using groups