Want the Average of sales for months up to date, with empty months included

How do I create an MDX that gives me the average of , f.ex., Sales
Note that some months may not have sales, but the month should still be counted.
The result I want to get out is a listing of Years with average of Sales for each year. Where current year only calculates up to current month.
Lets say that todays month is 2014-05 and we have the following figures for this year.
Month Sales
2014-01 10
2014-02 20
2014-03 Null
2014-04 15
2014-05 10
The calculation should be Sum(Sales) divided by 5 months: 55/5 = 11
If I use:
Avg( Descendants([Date].[Calendar].[Month].CurrentMemeber
, [Date].[Calendar].[Month])
, [Measures].[Internet Sales]
It will exclude 2014-03, which is wrong!
If I use CoalesceEmpty() to fill in the Nulls:
Avg( Descendants([Date].[Calendar].[Month].CurrentMemeber
, [Date].[Calendar].[Month])
, CoalesceEmpty([Measures].[Internet Sales],0)
It will fill in 0 for all months 2014 (up to 2014-12), which is also wrong!
It feels like a really simple calculation, but I can't make it work.
Thanks

I finally had to fix it by checking the number of months to get it right.
This solved my problem and gave me the correct averages on year and month level.
Create Member CurrentCube.[Measures].[COMPLAINT COUNT AVG CALC] As Null
,Format_String = ";;;\N\/\A",VISIBLE = 1;
    // For Year level - Show average of year = Sum/NumOfMonth. If this year then up to this month else divide by 12
    SCOPE([COMP CREATION DATE].[YEAR].[YEAR], [Measures].[COMPLAINT COUNT AVG CALC]);
        This = IIF([COMP CREATION DATE].[IS THIS YEAR].&[Y],
                        DIVIDE(SUM([COMPLAINT Count]),  Format(now(), "MM")),
                        DIVIDE(SUM([COMPLAINT Count]),  12)
        Format_String(This)="# ### ##0";
        NON_EMPTY_BEHAVIOR(This) = { [Measures].[COMPLAINT Count] };
    END SCOPE;
    // For month level - Show average of month = Sum/NumOfDaysInMonth
    SCOPE( [COMP CREATION DATE].[Year-Month-Date].[YEAR MONTHNO], [Measures].[COMPLAINT COUNT AVG CALC]);
        This = IIF(not isempty([Measures].[COMPLAINT Count]),
                Avg(
                    Descendants(
                     [COMP CREATION DATE].[Year-Month-Date].CurrentMember,
                     [COMP CREATION DATE].[Year-Month-Date].[DATE ID]
                    CoalesceEmpty([Measures].[COMPLAINT Count],0)
                    ,Null
        Format_String(This)="# ### ##0";
        NON_EMPTY_BEHAVIOR(This) = { [Measures].[COMPLAINT Count] };
    END SCOPE;
mStenport

Similar Messages

  • I purchased lightroom 5.  do I open this box or go with the black friday sale for all

    I purchased lightroom 5.  do I open this box or go with the black friday sale for all?  what happens next year after spending $9.99 a month without a disc for lightroom? does the monthly fee just continue?

    does the monthly fee just continue?
    Yes, with subscription products, if you want to keep using them, you keep paying the monthly fee.
    All updates and upgrades (e.g. LR6, LR7) are included in your membership but you never get to a point where you can stop paying and own the software.
    If you want to pay once and own the software then use the perpetually licensed version that you've already bought. You'll then have to pay again to upgrade to future versions such as LR6.

  • I have been sharing my iTunes account with my kids...now they are getting older and want to have their own accounts, how do I share the songs I purchased for them on my account with them on their new accounts?

    I have been sharing my iTunes account with my kids...now they are getting older and want to have their own accounts, how do I share the songs I purchased for them on my account with them on their new accounts?  Is there a way to transer from my main account their new accounts?  And can I share music from my account with them?

    You can't currently transfer content from one account to another account. As long as the tracks are on the computer's iTunes that they use/sync to, and your account is authorised on that iTunes, then they should be able to continue to use them.

  • Want the program to wait for some sec

    Hi,
    I'm trying to get a kinda sweeping effect with a couple
    of images. I need the program to wait X amount of
    millisec before it shows another image.
    How can I do this? I've tried using sleep and delay
    but I can't get it to work. I'm not using any threads.
    I just want the program to wait for a moment.
    Thanx

    try {
    Thread.sleep(millis);
    } catch (InterruptedException e) {
    }

  • I have a problem sending mail via smtp. I use a satellite system and the average return time for a ping is 675ms. Is this a problem with mail? If so can I change Mail to accept it. The problem also exists with Lion

    I have a problem sending mail via smtp. I use a satellite system and the average return time for a ping is 675ms. Is this a problem with mail? If so can I change Mail to accept it. The problem also exists with Lion and on both my MacPro and my wife's Imac. I also see my mailboxes randomly disconnecting and reconnecting. Any other ideas of a possible cause?

    I solved it myself, after the "note" which came back from FF/Mozilla just as I finished my message, commenting on what it was that my system had , I wnnt back to check my plug-ins etc. I downloaded the latest Java, BOTH 32bit AND 64 bit versions and latest Firefox.
    Now all is working.
    Thanks,
    B.

  • I want the Genius recommendation column back.  Is this possible with the latest iTunes?  If not, this was a poor decision to remove it :/

    I want the Genius recommendation column back.  Is this possible with the latest iTunes?  If not, this was a poor decision to remove it :/

    Hi,
    Genius recommendations are available in the itunes Store.
    Jim

  • How long does the IPhone5c battery last for without hardly any usage with about 2/3 to 3/4 left?

    How long does the IPhone5c battery last for without hardly any usage with about 2/3 to 3/4 left?
    Has the side affect of charging, where the battery's life gradually decreases overall with each charge, been fixed ?

    Eric,
    They did say 12-14 hours, but as is always the case with such estimates, they invariably quote the 'best possible scenario' and almost never mirror 'real world' conditions.
    If, from a fully charged position, you simply switch on your nano, and set it to continuously play through a long set of songs, with EQ off, backlight off, modest volume (50%) don't touch it during playback, then you might just get somewhere near this figure - and if you don't then it's either not been conditioned properly or it's faulty.
    If you use it like me, daily for a couple of hours, with 2 secs backlight and switch songs regularly, using fairly high volumes then 6-8 hours is more likely. It'll even drain when it's not in use, even in sleep mode, albeit very slowly. They also tend to drain more quickly before they've been through their first few charge cycles (the conditioning period).
    Personally I haven't got a problem with this though I can understand why some people have. It's not very impressive in this respect. Apple should be able to come up with something much better - maybe they should talk to Sony

  • HT201359 Why the ISTORE of Malta is not up to date with the latest movies and series like the UK & USA and why old movies are being uploaded .

    Why the ISTORE of Malta is not up to date with the latest movies and series like the UK & USA and why old movies are being uploaded .
    I believe the apple should be universal in all the products and a small island like Malts should have the same products for sale on ISTORE like of the UK and USA.

    The iTunes and App stores are inherently different in different countries.  Local laws on copyright and other limits on the distribution of intellectual property make it impossible for Apple to simply put everything in every store.  Sometimes, the owner of the intellectual property does not allow it to be distributed everywhere.  Keep in mind that Apple does not own the music, books, movies and such that they allow for sale in their store front, so they do not necessarily have any say in what may, or may not appear in what store.

  • I have the IPhone 4s and it is up-to-date with all upgrades.  Just recently I changed my YAHOO! password however each time I go into settings to update the password I keep getting "YAHOO! Server Unavailable Please try again later."

    I have the IPhone 4s and it is up-to-date with all upgrades.  Just recently I changed my YAHOO! password however each time I go into settings to update the password I keep getting "YAHOO! Server Unavailable Please try again later."  I have lost my YAHOO! email connection, all calendar entries and saved notes.

    A lot of people have been unable to access Yahoo e-mail on their iPhones or iPads. My wife’s iPad was not downloading Yahoo mail, although her iPhone was. Both used IOS 8.2. We tried deleting the account several times and troubleshooting all of the other settings. The problem appears to have been that allowing the IOS to automatically create the account on the iPad resulted in the wrong settings for the incoming server. The following procedure, pieced together from two websites, fixed the problem for us. So far, so good.
    https://portal.smartertools.com/kb/a2659/configure-imap-for-iphone-or-ipad.aspx
    https://help.yahoo.com/kb/mobile-mail/imap-server-settings-sln4075.html
    On the iPhone, tap Settings.
    Tap Mail, Contacts, Calendars.
    Tap your Yahoo account, then delete it.
    Tap Add Account.
    Tap Other.
    Tap Add Mail Account.
    Complete the Name, Address (email address), Password and Description fields.
    Click Next.
    Ensure IMAP is selected.
    Enter the following incoming mail server information:
    Incoming Mail (IMAP) Server - Requires SSL
    Server: imap.mail.yahoo.com
    Port: 993
    Requires SSL: Yes
    Hostname is mail.yahoo.com.
    Username is your full email address
    Password is the same password used to access webmail.
    Enter the following outgoing mail server information:
    Outgoing Mail (SMTP) Server - Requires SSL
    Server: smtp.mail.yahoo.com
    Port: 465 or 587
    Requires SSL: Yes
    Requires authentication: Yes
    Username is your full email address
    Password is the same password used to access webmail. It may have been entered for you.
    Tap Next.
    The iPhone will establish an SSL connection to your IMAP and SMTP servers.
    That’s all!

  • Enable the extension to keep chrome bookmarks up to date with the safari bookmarks on your iphone

    on my laptop icloud comes up and tells me i need to enable the extension to keep chrome bookmarks up to date with the safari bookmarks on your iphone! if someone could help me i would be grateful !!

    Once you click "get new recovery key" all data on your sync account is erased forever. There is no way to get that back. If you have data on your iPhone you cannot move it from your iPhone to desktop Firefox. the iPhone sync is 1-way only. Unless you have a Firefox profile somewhere, you will ahve to manually rebuild your bookmarks.

  • I want the table fields name for the screen fields of transactions lm59

    Hi all
      I am enhancing transactions LM58,LM59and  LM 60
      But in that transactions underthe lable of storage bin , there are 3 input fields . I want to know the exact table fields for those 3 input screen fields .

    Ravi,
    OK.
    You can look to tables EKPO, EKKO for PO-related fields.
    Look to SE84 under   ABAP Dictionary > Fields > Table Fields   - This is search tool for existing names.  Or can create custom Y-   and  Z- fields, data elements, domains to meet your needs.
    Please reward points.

  • Problem in taking the average of a column and grouping by date

    Hi all,
    I created a logical column using a formula in "Administration". The formula is like;
    Duration%=(Duration*100)/(X-Y).
    Then, in "answers", I created a report using Duration% column and another column which is its average. I want to see the average of Duration% values grouped by date.
    The numbers in the report are incorrect. What can be the reason for this? Does using logical column which is derived with a formula cause a problem when we take its average?
    Thanks in advance for your help..

    use avg(Duration% by <"Date Table"."Date Level"> in the answers column.
    substitute "Date Table" with your actual time dimension table name, and "Date Level" with your actual date column that you want to group by.

  • Will the Logitech Tablet Keyboard for Android 3.0+ work with the Playbook 2.0 OS?

    Thinking of buying the Logitech Tablet Keyboard for Android 3.0+ for my Playbook but before I do I want to make sure it'll work with my Playbook with the new 2.0.  Can anyone help?

    Hi Patrick,
    short storry: you can not setup Sun VDI 3 that way.
    Long story: Sun VDI 3 takes advantage of the VBox webservice to register, startup, poweroff, etc. VMs. The configuration and startup of the webservice is handled via a VBox installation script/installer that is bundled with Sun VDI 3 (and this installer is available for Solaris 10 only). Furthermore, we require a specific VBox version, because the VBox API has changed incompatible between 2.0.x, 2.1.x, 2.2.x, etc. - Sun VDI 3 currently supports 2.0.8. Thus any VBox VMs created with 2.1 or 2.2 will not run in a Sun VDI 3 environment.
    The typical Sun VDI 3 setup requires that the core and VBox parts are installed on a Solaris 10 machine (either both on the same machine or separate ones). For both the core and the vbox parts we provide a corresponding installer available via the Sun VDI 3 download page. Furthermore, you also need another machine for the ZFS/iSCSI storage part (e.g. running OpenSolaris). Please refer to the Sun VDI 3 documentation for all the details and background.
    You can still install VBox also on a laptop with your preferred OS and use this setup for example for preparing your VMs that should later be imported and executed in a Sun VDI 3 environment. However, as stated this requires the VBox 2.0.8 version (there is a link on the Sun VDI 3 download page pointing to the compatible VBox versions for other OS).
    - Klaus

  • How to get the salesprice and condition for a customer / material / date

    Hi all,
    how can I get the correct price and condition for a customer / material / date ?
    I know this is possible using the BAPI_SALESORDER_SIMULATE, but this bapi is using to much ressources on the system.
    I'm trying to get the correct price and condition WITHOUT using that BAPI.
    Does anyone know how it is possible ? As said before : I have the customer, material and a date.
    thanks in advance for your help

    Hi
    You need it because it's possible to have a complex pricing procedure, and you can't do it with a simple select on a table. Think that you can have pricing requirements, formulas (ie: VOFM) and so on in your pricing procedure (tcode V/08).
    I hope this helps you
    Regards
    Eduardo

  • What is the easiest way to get time stamped wvm data with AI samp Ch Vi?

    The AI sample channel VI only outputs single point waveform data which is making it a beast for me to get my input data into XY graphs. I have been trying to combine the data with a elapsed time clcok so I can synchronize all my inputs but it isnt working too great. All this stuff is in a while loop also, so that gives me trouble. Basically I just want to make an XY graph from both AI inputs.
    Attachments:
    PID_Control_LoopII.vi ‏326 KB

    Tim, no problem. I have attached the modified code that displays the readings from both devices on the same plot. I used a chart instead of an XY graph since it is much easier to use (it keeps track of elapsed time for you if you know the amount of time in between data points - and since the loop time is fixed we do know that). If this time were to change, then we would have to re-create the X-axis (time) and the XY graph would be necessary. One other note - the code that reads the values from the DAQ cards will not execute at exactly the same time, therefore the data will not be acquired at exactly the same time, though it will be close. Therefore, if your application requires these readings to be dead on together in time down to the mi
    crosecond for example, then you would have to synch the two devices via hardware. Let me know if you intend to do that and I can steer you in the right direction. Hope this helps.
    Attachments:
    PID_Control_LoopII_rev_2.vi ‏89 KB

Maybe you are looking for