i have these columns in the table and made this table as the FACT table and also using time intelligence filter in the PPS2010..
i have measures , sum (materials), sum (sales) and sum (material_%)
in the PPS dashboard design i have included this cube and all the measures.. and using an analytic chart..
i have developed separate graphs for each columns (material, sales, material_%)..
for the sales and materials there is no problem , when i use the time filter
in the material_% graph i used the time filter current quarter in months (showing three months ) shows the correct value..
when i use the current quarter filter (sum of all the 3 months)
its showing 146% (83 +33 +30) --> for actual values
and 150 % ( 50+50+50) --> for target values
actually it showed show me 46% for actual and 50% for target ,
it should be sum of material in all the 3 months / sum of sales in all the 3 months but its just calculating sum of material_% column of all the 3 months
time filter : year :: Halfyear ::quarter:: Month::Day
DataBase Table:
Month Year Material sales Material_% [ material / sales]
Jan_Act 2011 500 600 83
Jan_target 2011 400 800 50
Feb_Act 2011 300 900 33
Feb_target 2011 300 600 50
Mar_Act 2011 300 900 30
Mar_target 2011 300 600 50
......
Jan_Act 2012 0 0 0
Jan_target 2012 600 1000 60
.............
Dec_Act 2012 0 0 0
Dec_target 2012 600 800 75
MDX Query:
SELECT
HIERARCHIZE( { [Time_dim].[Year - Half Year - Quarter - Month - Date].DEFAULTMEMBER } )ON COLUMNS,
HIERARCHIZE( { [Ven Bi Actfctmaster].[Act Fct].&[ACTUAL], [Ven Bi Actfctmaster].[Act Fct].&[TARGET] } )ON ROWS
FROM [Vin Finance]
WHERE ( [Measures].[Materials - Ven Bifullrptmaster] )
Please help me to sort out this issue.
i solved this issue by changing the measure of '%' columns from sum to averageofchild in the property tab..
Related
lets say that i have table like this
ITEMNAME JANUARY FEBRUARY
Table 20 100
Chair 30 50
and i want to show it like this
ITEMNAME JANUARY FEBRUARY SUM
Table 20 100 120
Chair 30 50 80
the question is how to show that table with query?
You can do it like this
SELECT item, january, february, (january+february) AS sum
FROM table
It hasn't been tested yet, but I think it works
I've a Measure like below,
Year ProductCategory CompanyId TotalCustCnt SalesAmt Rank
2012 Prd1 1 20 100,000 1
2012 Prd2 1 10 75,000 2
2013 Prd1 2 18 80,000 2
2013 Prd2 2 15 50,000 1
Now I want to calculate three averages out of this data.
Average = SalesAmt / TotalCustCnt
Company average (Average for each company)
Leader average (Average for the leader for the Product category,year i.e company with Rank 1)
Industry average (Average for the whole industry for the product category,year)
The first one is straight forward, I've added a calculated field in the CUBE for adding an expression (SalesAmt / TotalCustCnt)
But how do I calculate the other two averages?
I've checked the AVG function and also tried SUM([Measures].[SalesAmt].ALLMEMBER) / SUM([Measures].[TotalCustCnt].ALLMEMBER) but no success.
I have a SSAS 2012 cube that has project name, milestone name and milestone date dimensions. The basic measure is dollars spent. I need an additional calculated measure of the cumulative dollars for a project spent through each milestone date.
Example of Data:
Project Milestone Milestone Date Spent Running Total
A 1 1/1/2015 10 10
A 2 2/23/2015 35 45
A 3 4/5/2015 4 49
B 1 6/7/2015 2 2
B 2 9/7/2015 49 51
The milestone date dimension is referenced through the Milestone dimension. Any suggestions on how to create the calculated measure would be appreciated.
Here is an example against AdvWrks:
WITH
MEMBER [Measures].[rnTotal] AS
Sum
(
(NULL : [Date].[Calendar].CurrentMember)
*
[Product].[Category].CurrentMember
,[Measures].[Internet Sales Amount]
)
SELECT
[Measures].[rnTotal] ON 0
,
[Product].[Category].[Category]
*
(
[Date].[Calendar].[Month].&[2006]&[6]
:
[Date].[Calendar].[Month].&[2007]&[6]
) ON 1
FROM [Adventure Works];
Im trying to figure out the total for the quarter when the only data shown is a running total for the year:
Id Amount Periods Year Type Date
-------------------------------------------------------------
1 65 2 2014 G 4-1-12
2 75 3 2014 G 7-1-12
3 25 1 2014 G 1-1-12
4 60 1 2014 H 1-1-12
5 75 1 2014 Y 1-1-12
6 120 3 2014 I 7-1-12
7 30 1 2014 I 1-1-12
8 90 2 2014 I 4-1-12
In the data shown above. The items in type G and I are running totals for the period (in qtrs). If my query returns period 3, is there a sql way to get the data for the qtr? The math would involve retrieving the data for the 3rd period - 2nd period.
Right now my sql is something like:
SELECT * FROM data WHERE Date='4-1-12';
In this query, it will return row #1, which is a total for 2 periods. I would like it to return just the total for the 2nd period. Im looking to make this happen with SQLite.
Any help would be appreciated.
Thank alot
You want to subtract the running total of the previous quarter:
SELECT Id,
Year,
Type,
Date,
Amount - IFNULL((SELECT Amount
FROM data AS previousQuarter
WHERE previousQuarter.Year = data.year
AND previousQuarter.Type = data.Type
AND previousQuarter.Periods = data.Periods - 1
), 0) AS Amount
FROM data
The IFNULL is needed to handle a quarter that has no previous quarter.
How can i count the days within/without sales in a period.
I defined a MDX query below:
SELECT { [Measures].[Sales], [Measures].[Amount] } ON COLUMNS
NONEMPTY({ [Dim Customer].[Customer ID].[Customer ID].ALLMEMBERS *
[Time].[Month].CHILDREN
}) DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS
FROM [MyCube]
The result shows me for each customer and month how many sales and amount the customer had in the corresponding month.
CustomID / Month / Sales / Amount:
1 / 2013 01 / 123 / 2234:
1 / 2013 02 / 2 / 95:
1 / 2013 03 / 212 / 11111:
2 / 2013 01 / 122 / 2121:
2 / 2013 02 / 231 / 3333:
Now I need a counter/column which shows me the value of days in the month without sales.
CustomID / Month / Sales / Amount / DaysNoSale:
1 / 2013 01 / 123 / 2234 / 3:
1 / 2013 02 / 2 / 95 / 26:
1 / 2013 03 / 212 / 11111 / 0:
2 / 2013 01 / 122 / 2121 / 0:
2 / 2013 02 / 231 / 3333 / 0:
In cube we have the details for every day so it´s possible to show the number of sales per day.
On days witout sales this number is 0.
Has anybody an idea how i can solve this rquest.
Thanks forward
Assuming your Day attribute is named [Time].[Day], you would use:
WITH Member Measures.[Days No Sale] AS
Filter([Time].[Day].[Day].Members * { [Time].[Month].CurrentMember },
([Measures].[Sales], [Dim Customer].[Customer ID].CurrentMember) = 0
).Count
SELECT { [Measures].[Sales], [Measures].[Amount], Measures.[Days No Sale] }
ON COLUMNS,
NONEMPTY({ [Dim Customer].[Customer ID].[Customer ID].ALLMEMBERS *
[Time].[Month].CHILDREN
})
DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME
ON ROWS
FROM [MyCube]
[Time].[Day].[Day].Members * { [Time].[Month].CurrentMember } is the cross product of all days in the cube with the current month of the row. And due to the Analysis Services Autoexists feature, this only returns non empty tuples, i. e. one tuple for each day in the month, as e. g. there is no record in the time dimension table containing September, 10, 2014 in the day column and July 2013 in the month column. I. e. the cross product within a dimension is not a real cross product in Analysis Services.
Then the Filter method restricts these to those having no sales for the current customer id, and finally the Count just counts these.