Weighted avg and stdev calculations with SSAS

Hi, I need to write a calculation within BIDS calculations tab, that works for every query within my cube for a specific measure. I'd already tried several recommended approaches with no luck. Thanks!

I wanted to dynamically select a measure.  I created a dynamic Query that pulls back the expected stnd deviation and mean using this:
With
member
[Mean] as
iif(IsEmpty(Axis(0).Item(0)),
NULL,
Avg(Axis(1).Item(0).Item(0).Dimension.Children,
Axis(0).Item(0))),
format_string = 'percent'
member
[Standard Dev] as
iif(IsEmpty(Axis(0).Item(0)),
NULL,
StdDev(Axis(1).Item(0).Item(0).Dimension.Children,
Axis(0).Item(0)))
select
{[Measures].[Number 1],[Mean],[Standard Dev]}
on 0,
non empty([Date].[Calendar].[Month].&[2009]&[3]
,[Names].[Name].&[Name 1])
on 1
from
[Cube]
Where
([Organization].[Organization Name].&[Name 1]
I then take the members (from the dynamic query) and add them as 2 calculations (Mean and Standad Dev) in the cube.
I run this query after i deploy and process the cube:
select
{[Measures].[Number 1],[Mean],[Standard Dev]}
on 0,
non
empty([Date].[Calendar].[Month].&[2009]&[3]
,[Names].[Name].&[Name 1])
on 1
from
[Cube]
Where
([Organization].[OrgName].&[[OrgName 1])
I come up  with the same results.  All is good, until I try to use report builder to add these calcuated measures.  Is there something special about the way report builder or cube browser (from SSMS) creates
the MDX behind the scenes that would prevent this dynamic query from working properly?  I am using the the OrgName in the filter and add the same measure, month, Name to the cube query designer.
Any suggestions would be helpful. 
Jake Kremer - Senior Business Intelligence Consultant - Project Leadership Associates

Similar Messages

  • Weighted avg Unit Cost calculation for COGS

    Hi friends,
    Has any body done weighted avg unit cost calculation for inventory valuation and COGS calculation. In a way we need to mirror ECC material ledger functionality based on the APO data in side the planning tool.
    Any ideas on the above!!!
    Kind Regards,
    Krish

    Hi Jerry,
    Thanks for the tip. I actually needed to clean the spreadsheet up and put bogus values in to comply with company policy. Anyhow, here is a sample of the spreadsheet
    http://dl.dropbox.com/u/7499586/junk.png
    Just imagine about 100 products and several hundred raw materials, a dozen types of labor and about 30 types of packaging. It's a monster spreadsheet.
    The "units" under each product is the number of units per batch. You can see each product has two columns. One where you put in how much of a raw material, package type, and labor type go into each batch, the next calculates the cost for each item. Then it gets summed at the top for the total unit cost for that product.
    Let me know if you have any other questions about it. Thanks so much for your help!

  • There is something wrong with the volumes buttons in my macbook pro, every time i pressed the one who raises the volume, it leads me to the screen where (i do not no what its called) the background is black with the date and time and a calculator.

    There is something wrong with the volumes buttons in my macbook pro, every time i pressed the one who raises the volume, it leads me to the screen where (i do not no what its called) the background is black with the date and time and a calculator. However, when i lower it, my safari tab goes out of the screen. What do you guys think i should do? I'm getting very nervous.

    hey HAbrakian!
    You may want to try using the information in this article to adjust the behavior of your function keys to see if that resolves the behavior:
    Mac OS X: How to change the behavior of function keys
    http://support.apple.com/kb/ht3399
    Take care, and thanks for visiting the Apple Support Communities.
    -Braden

  • When I start firefox, i get this message ( The instruction at "0x7b9c77a9" referenced memory at "0x7b9c77a9". The memory could not be "read" ) hs anyone any idea why? I have scanned with AVG and something simply called 'Trojan Remover' and they both fin

    when I start firefox, i get this message ( The instruction at "0x7b9c77a9" referenced memory at "0x7b9c77a9". The memory could not be "read" ) hs anyone any idea why? I have scanned with AVG and something simply called 'Trojan Remover' and they both find nothing.... any advice would be greatly welcomed.. thanks
    == This happened ==
    Every time Firefox opened
    == this morning 22/07/10

    Lyall,
    I have seen this before, a long time ago (several years), and I cannot
    remember how/if we resolved it.
    If this is an impotant issue to you, I suggest that you open a case with
    BEA support.
    Regards,
    Peter.
    Got a Question? Ask BEA at http://askbea.bea.com
    The views expressed in this posting are solely those of the author, and BEA
    Systems, Inc. does not endorse any of these views.
    BEA Systems, Inc. is not responsible for the accuracy or completeness of
    the
    information provided
    and assumes no duty to correct, expand upon, delete or update any of the
    information contained in this posting.
    Lyall Pearce wrote:
    The title says it all really.
    I see other posts getting replies.
    This is a rather important issue, I have seen another post with a similar problem.
    While not being a show-stopper it certainly raises concerns.
    The application works ok until the application exits (in both development and
    executable form)
    Apparently this did not happen with Tux 7.1
    It does with 8, I do not have 7.1 so I have no workaround.
    ..Lyall

  • Weight and volume calculation in sales order

    Hi,
        I have one requirement to populate weight of line item material in the sales order based of plant.
    When the processing of sales order is trigerred the value in the reference characteristic will be available in the User Exit MV45AFZZ through the function CUCB_GET_VCSD_UPDATE.  Passing VBAP-CUOBJ.  If material is batch managed (MARA-XCHPF  = “X”), then use VBAP-CUOBJ_CH.
    1.     Configured Material
    The VC model will populate either a volume field or linear foot field, depending on the type of material, in the SAP communications structure VCSD_UPDATE.  If either field is populated then this user exit will take the value found in VCSD_UPDATE and extend it by the plant specific weight value and the total quantity referenced in the sales document.  This total value is then moved in the weight field in the table VBAP.
    2.     Static Material with plant specific weight
    If both fields in VCSD_UPDATE are not populated then the plant specific weight value is extended by the total quantity referenced in the sales document. This total value is then moved in the weight field in the table VBAP.
    3.     Static Material with static weight
    If both fields in VCSD_UPDATE are not populated and a plant specific weight value not found then the static weight, presumably the weight value in MARA, extended by the total quantity referenced in the sales document. This total value is then moved in the weight field in the table VBAP.  Note: The static weight could be maintained in the plant specific repository in which case this third test is not necessary.  However, this will create a lot of redundant entries in the repository for plant specific weights.
    How to calculate?
    Please explain step by step?What logic i have write?
    Thanks & regards,
    sairam

    Please help me it is very  urgent.
    Thanks & Regards,
    sairam

  • How about telling us in advance what programs or plug ins will NOT work with the new Firefox. I just lost my "safe search" feature with AVG, and I think that's sort of important!

    Just upgraded to Firefox 6 (which I like, by the way), but when I upgraded to 5, I lost the gaming feature when I installed AVG, and now I've lost the AVG safe search feature, which I think is very important considering that I have grandkids that use my computer,
    How about telling us in advance (and I'm running Firefox, so a link would be easy) whether or not we're going to lose an important feature like the one I lost?
    So, how do I get back to Firefox 5 without uninstalling and reinstalling so I can have that safe search feature back?

    Attached is Dennis Linam’s Audition – “Log File” and “Log – Last File”
    Contact information Dennis [email protected]
    Previous contact information with your organization (DURIM):
    Dennis - i just finished my audition trial and bought the subscription the 2014 version.
    created by durin in Audition CS5.5, CS6 & CC - View the full discussion 
    DURIM - Okay.  I would expect the "Cache Warning" message because your default directories would not be the same as the ones in the settings file I generated.
    If you go back to the "7.0" directory and open the "Logs" folder, can you copy the "Audition Log.txt" file and send it as an attachment to [email protected]?  We'll take a look in that logfile and see if it gives us more information about why this is failing now.
    Also, do you have any other Adobe applications installed on this machine, such as Premiere Pro?  If so, do they launch as expected or fail as well?
    I do have the trial Pro version of Adobe reader, but I have not activated it, because I fear the same thing will happen did it. I cannot afford to activate the subscription for that product and take the chance of it not working either. I depend on those two programs religiously. Here is the files that you requested. I appreciate any help you can give me to get this audition program started
    Audition Log- file
    Ticks = 16       C:\Program Files (x86)\Common Files\Adobe\dynamiclink\7.0\dynamiclinkmanager.exe
    Sent from Windows Mail

  • How Achieve timedseries calculations with out using AGO And ToDate function

    Hi,,
    1)
    How Achieve timedseries calculations with out using AGO And ToDate functionion
    this question asking in interview ..is it possible..?
    if yes please response as soon as possible..
    2) i have 2 cloumns Product and value...
    client requirement is they need ranks based on Value ..in dashboard .using dashboard prompt..edit box...if user enter any number (ex :5 ) report should show top 5 ranks if he enter 20 should be top 20 ranks..
    how to achive this ?
    thanks,
    raj

    Consider yor first question:
    1. Yes, we can create timeseries measures without using AGO and TODATE
    1. Create ALIAS of fact tabe in the physical layer
    2. Join the Time id from the ALIAS fact table with the YAGO_MONTH_ID column from your time dimension table (For calculating Year Ago variants) similarly join with MAGO_MONTH_ID column for Month Ago measures.
    3.Pull the ALIAS tables as an additional Logical table source in the Lgical layer
    4.Keep the mapping of the columns from the ALIAS table as its is
    5. For e.g If you pick Revenue from the Year Ago Alias table it will give you the "Prior Year Revenue"
    See if this helps you

  • AVG tried to take over the Firefox Program. I unchecked some stuff on AVG and now Firefox doesn't lool right. There is only a bar at the top of the page with "Firefox" and "new Tab" . How do I get the Firebox homepage back?

    AVG tried to take over the Firefox Program. I unchecked some stuff on AVG and now Firefox doesn't look right. There is only a bar at the top of the page with "Firefox" and "new Tab" . How do I get the Firebox homepage back?

    Google Toolbar Options, in the Search tab, make sure that '''Enable the Google new tab page''' is check-marked. If that doesn't fix it for you, see this for support information about the Google Toolbar. <br />
    [http://www.google.com/support/toolbar/?hl=en] <br />
    Or visit the Google Toolbar forum. <br />
    [http://www.google.com/support/forum/p/Toolbar?hl=en]
    As far as your UserAgent showing Firefox 3.0.11, see this: <br />
    https://support.mozilla.com/en-US/kb/Websites+or+add-ons+incorrectly+report+incompatible+browser
    You might want to consider getting rid of that '''desktopsmiley''' program that has messed up your UserAgent, it is known as Malware.

  • Calculating  YTD AVG and QTD AVG

    Hi All,
    I am trying to crate custom measure formula for calculating  YTD AVG and QTD AVG in BPC 7.0 NW any help

    For this formula I am using Sum divided by..
    MEMBER [MEASURES].[YTD] AS 'IIF([%P_ACCT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="INC",SUM(PERIODSTODATE([%TIME%].[LEVEL00], [%TIME%].CURRENTMEMBER),-[MEASURES].[/CPMB/SDATA]),IIF([%P_ACCT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="EXP",SUM(PERIODSTODATE([%TIME%].[LEVEL00], [%TIME%].CURRENTMEMBER),[MEASURES].[/CPMB/SDATA]),IIF([%P_ACCT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="AST",([MEASURES].[/CPMB/SDATA], CLOSINGPERIOD([%TIME%].[LEVEL02])),IIF([%P_ACCT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="LEQ",-([MEASURES].[/CPMB/SDATA], CLOSINGPERIOD([%TIME%].[LEVEL02])),-[MEASURES].[/CPMB/SDATA]))))';SOLVE_ORDER=3
    can please help me..

  • Weighted avg. price and quantity invoiced

    Hi,
    How to get the Weighted avg. price and quantity invoiced for a particular material(only invoiced price should be taken and not the purchase order price).  If possible provide me the related tables/FM/report etc.
    for e.g.on sel. screen if a material no. and an year is entered then I need the weigthted avg. price for 12 periods (jan2007, feb 2007 etc.) and qty invoiced for those months.
    Thanks for your help.

    Hi Ayyalas,
    You have to change error message in to warning message.
    Because in standerd system its warning message.
    Thanks and regards
    Gitesh

  • Route with weight group and without weight group

    Hello All
    I have created two  same routes  as per user requirement one with weight group and other is without weight group.once the delvery is created the route is picked up.But how do i know whether this route is with weight group or without weight group.
    Could you please clarify so that i can proceed for testing.
    Regards
    T.Srikanth

    Dear Srikanth,
    Try this
    Go to SE16 enter LIKP table then execute here you enter your delivery number then go to menu>Settings>Format list-->Clik on Choose fields here you deselect all the fields you select
    VBELN  - Delivery
    GRULG - Weight group
    PERFK - Route then execute now you can get the details about the delivery number , weight group and Route.
    If system displays only Delivery and Route you can understand there is no involvement of weight group in the route determination.
    If the system displays Delivery,weight group and route then you can understand that thre is weight group involvement in the route determination.
    I hope this will help you,
    Regards,
    Murali.
    Edited by: Murali Mohan.Tallapaneni on Nov 5, 2008 6:51 AM

  • "Totals calculation issue" when I filter member used in an scope calculation with descendant aggregation

    Hello everybody
    I have a Geography dimension (Country -> State -> City) and 2 related Fact Tables: "Revenues" (with measure Revenue) and "Revenue Goal" (with measure Revenue Goal)  and  created a dummy measure into the Revenue Fact table
    (in the dsv) to calculate the Revenue not planed (by city) using Scope.
    The calculated measure "NotPlannedRevenue" is defined using a Dummy measure on the Revenue FacTable with null like default value, later using Scope I have calculated the values in order to get correctly Totals Values over the a Geography hierarchy
    which is working properly. The MDX script for the measure is 
    SCOPE([Measures].[NotPlannedRevenue]);
    SCOPE ([Geography].[GeoHier].[City].Members);
    THIS=iif([Measures].[Revenue Goal]=0 , [Measures].[Revenue] ,0 );
    END SCOPE;
    SCOPE( [Geography].City.[All]);
    This =sum( Descendants([Geography].[GeoHier].CurrentMember,,LEAVES),[Measures].[NotPlannedRevenue]);
    END SCOPE;
    SCOPE( [Geography].State.[All]);
    This =sum( Descendants([Geography].[GeoHier].CurrentMember,,LEAVES),[Measures].[NotPlannedRevenue]);
    END SCOPE;
    END SCOPE;
    When I check the data,  I get "Totals" well calculated.
    The issue is when I filter Cities from the Geography dimension, the total values are not being calculated using only the selected cities. I have problems in the totals by City, State, Country.
    The total for the State "Karnatak" must by "0" and the grand total must be "10".
    Please someone could help me to solve the way which I must write this MDX or maybe I have to use another strategy.
    Thanks in advanced.
    Gelder de la Ossa

    You shouldn't need the second and third SCOPE statements (on the All members of City and Country) if the first one has been configured correctly - what happens if you remove them?
    Chris
    Check out my MS BI blog I also do
    SSAS, PowerPivot, MDX and DAX consultancy
    and run public SQL Server and BI training courses in the UK

  • Pension calculation with wage type max. limit

    Hi ,
    Pension for my client is to be calculated as 5% of Basic, Child, Social and Housing.
    Basic,Child and Social are pay components.Housing is not a pay component but for pension calculation is to be taken as 60% of basic for which we have created a wage type.
    Now the issue is the housing amount is not to exceed 8000, i.e. if my basic is say 20000 my housing becomes 16000 but for my pension calculation I have to take only 8000.
    Where do I maintain it or how do I call it to calculate in a rule.
    Any help is appriciated
    Regards
    Uday

    store a constant in table t511k as 8000.
    write a small rule to compare the value of housing wagetype with this constant value, and repalce it with constant value if value greater than 8000.
    Hope this helps.

  • Preference calculation with batch management

    Hi experts,
    I am trying to find any documentation or manuals about how to set-up and use preference calculation in SAP-SD-FT or GTS based on batch management.
    Does anyone of you know how to do it and use such kind of "standard"-SAP-solution or is customer-specific programming essential.
    Any reply would be much appreciated.
    Best regards,
    Corinne

    Hi Corinne,
    Did you get anything for your requirement specific to Preference calculation with batch management. I am also looking for the same. let me know if you found something useful or if you created an enhancement to resolve this issue.
    Regards,
    Sumit

  • How to read csv Data and save it with no format changes

    Hi,
    At first I am not used to Diadem.
    I want to read in a csv file do some calculation with the data and save the changed data in the same csv file. A file as an example is attached (496888_edit.csv).
    Therefore I wrote this lines:
    Dim i
    Dim Delimiter
    Dim FilePath
    Dim FileParameters
    Delimiter = ";"
    Call DataFileLoad(FilePath,"CSV","Load")
    ' Do some calculations
    FileParameters = "<filename>"&FilePath&"</filename>"&"<delimiter>"&​Delimiter&"</delimiter>"
    Call DataFileSave(FileParameters,"CSV")
    After running that lines the csv file is looking like the other attached file (496888_after.csv)
    Because of some reasons which I could not explain Diadem is rounding the numbers. I want that both files look the same.
    What can I do?
    There might be another extension. Just to read in some columns, doing some calculations and after the calculation saving that columns in the file instead of the originals. (The csv files are much bigger like the two examples)
    Thanks,
    Jens 
    Attachments:
    496888_edit.csv ‏1 KB
    496888_after.csv ‏1 KB

    The only thing that can be changed in writing float64 values using the CSV plugin is the decimal point ('.' or ',').
    The format of the doubles is not rounded but the CSV writer only writes the relevant digits.
    It is using up to 15 digits which is the resolution of float 64. It would also switch to scintific writing if necessary.
    So there is no way to force only 6 digits and filling 0s are left out. So if you just fear that you loose precision that will not happen.
    (only the typical problems of epressing a 2 system binary value in a 10 system text string)
    If you are interested to have a fix float format the only solution is to write with VBS directly to a file doing formatting on your own, which is slow.

Maybe you are looking for

  • Displaying a PDF File 'In Place'

    Hi, Can SAP display a PDF 'in place' like it can display an Excel spreadsheet 'in place?' Thanks, Malini.

  • Error creating Purchase Order

    Hi Gurus, I've this issue. I'm using SRM 5.0. I've configured a product category mentioning it needs to go to sourcing only when the vendor is not mentioned. Otherwise it should bypass sourcing and after the last approval the PO has to be created in

  • Call a remote Java API from PL/SQL

    Hi I want to call a remote Java API from my PL/SQL. Can someone please provide me the steps to do this? Thanks in advance -G

  • IBook shuts down after unplugging power adaper

    Hello there... My iBook G4 doesn't last for more than 10 minutes after I unplug the power adapter. I've checked some other posts and it looks like you need the information below before going any further. Any help on what I should do to remedy this pr

  • AAA commad authorization

    Dudes We had problem in replicatiing database to secondary ACS (4.2) server, Somehow I've managed to fix the issue by changing firewall inspection and shared secret.Now I've got new issue with "command authorization failed" after successfull authenti