SSAS Tabular - return number of days in given month using month's start date?

Is there a way to return the number of days in a month by providing just the month date or month start date?
We have a time table, but it is at monthly (not daily) granularity.
So I can't just count rows between start/end of month.
I need to be able to divide by the number of days in a given month and can't seem to find a way to get number of days in that given month.
Thanks!

Hi,
According to your description, you want to get the number of days in a month with the month's start date, right?
In this case, we can get the first day of next month using DateAdd function, and then use DateDiff function to calculate the number of days in this month. Here is a sample query for your reference.
WITH
MEMBER Measures.Today AS vba!Now()
member measures.FirstDayOfNextMonth as dateadd("m",1,Measures.Today)
member measures.daysnumber as datediff("d",Measures.Today,measures.FirstDayOfNextMonth)
select Measures.daysnumber on 0
from
[Adventure Works]
Reference
http://msdn.microsoft.com/en-us/library/hh510163.aspx
http://office.microsoft.com/client/helppreview14.aspx?AssetId=HV080007558&lcid=1033&NS=EXCEL%2EDEV&Version=14&tl=2&pid=CH080007543
http://office.microsoft.com/client/helppreview14.aspx?AssetId=HV080007559&lcid=1033&NS=EXCEL%2EDEV&Version=14&tl=2&pid=CH080007543
Regards,
Charlie Liao
TechNet Community Support

Similar Messages

  • Number of days in given date/month

    Hi,
    Can you send query to find the number of days in given date/month
    Regards,
    Venkat.

    If you want No. of days between two date then you can just Subtract them. If you want the number of days in a month you can get the first and last day of the month and subtract them.
    Solution for a month.
    SQL> with t as (select to_date('&month','mmyyyy') as dt from dual)
      2  select (last_day(dt) - trunc(dt, 'mm'))+1
      3    from t
      4  /
    Enter value for month: 012009
    old   1: with t as (select to_date('&month','mmyyyy') as dt from dual)
    new   1: with t as (select to_date('012009','mmyyyy') as dt from dual)
    (LAST_DAY(DT)-TRUNC(DT,'MM'))+1
                                 31
    SQL> /
    Enter value for month: 022009
    old   1: with t as (select to_date('&month','mmyyyy') as dt from dual)
    new   1: with t as (select to_date('022009','mmyyyy') as dt from dual)
    (LAST_DAY(DT)-TRUNC(DT,'MM'))+1
                                 28
    SQL> /
    Enter value for month: 122009
    old   1: with t as (select to_date('&month','mmyyyy') as dt from dual)
    new   1: with t as (select to_date('122009','mmyyyy') as dt from dual)
    (LAST_DAY(DT)-TRUNC(DT,'MM'))+1
                                 31Edited by: Karthick_Arp on Feb 19, 2009 9:56 PM

  • Since few days iPhone 4 suddenly uses huge amount of data and battery, how to find out which App is guilty?

    Hi Community,
    since Friday my iPhone 4 startet using huge amounts of mobile data and rapidly wastes battery lifetime (50% in 3 hous!) It also gets quite warm even when I don't use it at all.
    I suspect an app does this, because in flight mode battery is ok.
    How do I find out which app is to blame without having to uninstall all apps?
    Thanks for your help.
    Kind regards
    Nymphenburg

    You need to look into using the SQL*Loader utility:
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96652/part2.htm#436160
    Also, Oracle supports BULK inserts using PL/SQL procedures:
    http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/05_colls.htm#28178

  • How to get number of digits in given amount

    Hi Experts,
    How to get number of digits in given amount.
    Regards
    Mohit

    Check this :
    data: v_data1 type p decimals 3 value '12.860',
          v_char1 type char20,
          v_char2 type char20,
          v_char3 type char20,
          len type i.
    write v_data1 to v_char1.
    split v_char1 at '.' into v_char2 v_char3.
    len = strlen( v_char3 ).
    write:/ v_char2,
          / v_char3, " this holds the digit value
          / len.     " number digits

  • Timekeeper Access to 'Past Number of Days'

    Hi,
    Currently as per the setup in 12.1.3, Normal Users (Self Servie Time Responsibility) can update timecard based on '*Past Number of Days*' but Timekeeper (OTL Limited Timekeeper Responsibility) can update timecard *'Past Number of Days' + 1 week extra*.
    For Example:
    Current Date = 11-MAR-2013
    *'Past Number of Days' in USER Edits* = 27
    Self Service Time Responsibility can update till = Week 16th FEB till 22nd FEB
    OTL Limited Timekeeper Responsibility can update till = Week 09th FEB till 15th FEB
    Do I need to do any settings or any profile setup so that even Timekeeper can update Timecard based on 'Past Number of Days' in USER Edits rather than 1 week extra ?
    Appreciate your help.
    Regards,
    Khan.

    forgot to mention....
    Status Allowing Edits = Retro
    Future Time Period LImit = Active Assignment
    Past Number of Days = 27
    Future Number of Days = NULL

  • Number of days issue

    Hello everyone,
    Here is my problem.  My user wants to have the number of days in a report based of an interval dates from posting date. 
    This is simple enough, i can just uses a formula variable to give the difference between the dates.
    But, if the user desided to drop in the posting period into the results rows, the user would like each period to show only the days in that period.
    So 01/05/2001 - 03/01/2001
    Would show a total 49
    If the user puts period in the results the user wants to see
    Period 1    Period 2     Period 3
    26             28          1
    Any ideas?
    Thanks!!

    Hi,
    It looks like your calculations doesn't depend on the date that the report is executed.
    Aren't you able then to calculate that differences on the data upload writing the result to a new key figure?
    If you have a record per each period then the solution is easy. If not... well then we'll have to think about another solution
    Hope it helps.
    Regards,
    David.

  • BW Query Designer  -  Replacement Path Issue - Need Number of Days

    The requirement is to have "Number of Days" (Key figure) by using the formula SY-DATUM MINUS General Availability Date.
    GA(General Availability (Date is Calculated Using a hidden Formula Variable with the Processing type u201CReplacement Pathu201D
    to convert the Free Characteristic 0WBS_ELEMT__CWBSUSR09 into the Date Format.
         The Sy-datum brought using another hidden Formula Variable with the Processing type u201CCustomer Exitu201D, after checking whether the Project Close date is in Future (after GA Date).
    There is SAP Note 1005772 available, it will be of Little Help.
    Rgds
    Venu

    Re: Years of Service
    Here is the similar scenario, but need help on how to resolve this issue.

  • Restrict Data Input in an Input Schedule for a particular number of days in a Month

    Hi All,
    I want to restrict data save in Input Schedule for any particular number of days in a month. BRAD will select number of days for the that particular month and data input for that duration should be disabled.
    Duration will be dynamic and will be decided by BRAD.
    Basically this is a requirement of BPF, but I have thought of doing in this manner.
    Regards,
    Mayank

    Hi Vadim
    I saw your this solution:
    Dim epm As New FPMXLClient.EPMAddInAutomation
    Dim blnMySave As Boolean
    Public Function BEFORE_SAVE() As Boolean
    If blnMySave Then
        BEFORE_SAVE = True
    Else
        MsgBox "Please use button on the worksheet!"
        BEFORE_SAVE = False
    End If
    End Function
    It seems as if this may help me, but can you please guide me how to trigger this function for a change of value in any particular cell, in an input form.

  • Number of Days from a given Date

    How can one calculate the number of days in a month from a given date?
    Ex: If I pass 07/12/2008 it should return 31

    But your example doesn't meet the OP request. The OP wanted the number of days in a month where the month is determined by a specified date (paraprhased).
    DimaCit gave two credible solutions that met that requirement. Yours just counts the number of days between two apparently arbitrary dates.

  • SQL help: return number of records for each day of last month.

    Hi: I have records in the database with a field in the table which contains the Unix epoch time for each record. Letz say the Table name is ED and the field utime contains the Unix epoch time.
    Is there a way to get a count of number of records for each day of the last one month? Essentially I want a query which returns a list of count (number of records for each day) with the utime field containing the Unix epoch time. If a particular day does not have any records I want the query to return 0 for that day. I have no clue where to start. Would I need another table which has the list of days?
    Thanks
    Ray

    Peter: thanks. That helps but not completely.
    When I run the query to include only records for July using a statement such as following
    ============
    SELECT /*+ FIRST_ROWS */ COUNT(ED.UTIMESTAMP), TO_CHAR((TO_DATE('01/01/1970','MM/DD/YYYY') + (ED.UTIMESTAMP/86400)), 'MM/DD') AS DATA
    FROM EVENT_DATA ED
    WHERE AGENT_ID = 160
    AND (TO_CHAR((TO_DATE('01/01/1970','MM/DD/YYYY')+(ED.UTIMESTAMP/86400)), 'MM/YYYY') = TO_CHAR(SYSDATE-15, 'MM/YYYY'))
    GROUP BY TO_CHAR((TO_DATE('01/01/1970','MM/DD/YYYY') + (ED.UTIMESTAMP/86400)), 'MM/DD')
    ORDER BY TO_CHAR((TO_DATE('01/01/1970','MM/DD/YYYY') + (ED.UTIMESTAMP/86400)), 'MM/DD');
    =============
    I get the following
    COUNT(ED.UTIMESTAMP) DATA
    1 07/20
    1 07/21
    1 07/24
    2 07/25
    2 07/27
    2 07/28
    2 07/29
    1 07/30
    2 07/31
    Some dates donot have any records and so no output. Is there a way to show the missing dates with a COUNT value = 0?
    Thanks
    Ray

  • How do i setup Mail account on my mac book like in mobile phone? I.e. Don't want to store the mails/attachments on pc, however need the latest emails for given number of days?

    How do i setup Mail account on my mac book like in mobile phone? I.e. Don't want to store the mails/attachments on pc, however need the latest emails for given number of days?
    This helps the storage and purpose of email as well. I could always log into online email account to find history of emails.
    Thanks
    Chai

    How do i setup Mail account on my mac book like in mobile phone? I.e. Don't want to store the mails/attachments on pc, however need the latest emails for given number of days?
    This helps the storage and purpose of email as well. I could always log into online email account to find history of emails.
    Thanks
    Chai

  • Returns Policy - Number of days

    Hi All,
    I am testing a condition where the number of days in the returns policy should be visible in the returns sales order document.
    Could anyone please let me as to where I can find the number of days in the Returns Sales order within which the customer is expected to return the products?
    Also, please mention the condition type in SAP SD in which I can configure the number of days for return.
    Many Thanks,
    Shilpa

    Dear Shilpa,
    I am testing a condition where the number of days in the returns policy should be visible in the returns sales order document.
    I Hope there is no return 'policy' mapped in SAP.
    Hence give us more input on how the return date is calculated for each order.
    i.e, is it fixed for all the customers/materials?
    Could anyone please let me as to where I can find the number of days in the Returns Sales order within which the customer is expected to return the products?
    Without mapping the process, you will not find the number of days in the return sales order.
    Also, please mention the condition type in SAP SD in which I can configure the number of days for return.
    Do you mean pricing Condition type ? if so, whats the relevance in this scenario.
    It would be great if you can just tell whats already mapped in your SAP and Whats the requirement in simple sentences.
    Thanks & Regards,
    Hegal K Charles

  • How to get the number of days between 2 given dates

    Hi all,
    How can I find the number of days between any 2 given dates.
    Thanks

    Hi
    Here's a dirty way:
    If you've got two Date objects in Java, call getTime() on each one (which gives you a value in milliseconds), then subtract the two millisecond values, and divide the result by the number of milliseconds in a day (24 * 60 * 60 * 1000). There's more `elegant' ways to do this, but this method only requires one line of Java.
    Best wishes
    Kevin

  • How to calculate the number of days worked for a given period

    I need to calculate the number of days worked by contractor employees for a time period to be entered by a user. I am building a query on an infoset which contains employee information including contract start date and contract end date for the employee.
    Ideally I'd like the user to enter the time period which should be reported on e.g. 01.08.2009 to 31.08.2009
    The report should then identify all the contractor employees which were working during this period and to work out how many days they worked during this period. Obviously the contract start and end dates could fall both inside and outside the reporting period.
    Can this be done and if so, do you have any suggestions as to how to do it?
    Thanks.

    hi
    So here you will first have to load the master data table employee in one internal table and read this table with the variables entries.
    Your code in the reporting exit should look like that.
    bye
    data : wa_employee type /bi0/pemployee.
    When 'ZDATE1'
    if i_step = 2.
    LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZDATE2'.
    clear l_s_range.
    clear wa_employee
    1- select the entries from table employees
    select single employee dateto datefrom
    from /bi0/pemployee
    into corresponding fields of wa_employee
    where dateto le loc_var_range-low
    and datefrom ge loc_var_range-high.
    if sy-subrc eq 0.
    CALL FUNCTION 'FIMA_DAYS_BETWEEN_TWO_DATES'
       EXPORTING
           i_datum_von  = wa_employee-datefrom
           i_kz_ult_von = 'X'
           i_datum_bis  = wa_employee-dateto
           i_kz_ult_bis = 'X'
           i_szbmeth    = '1'
       IMPORTING
          e_tage       = no_days.
           l_s_range-low  = no_days.
           l_s_range-sign = 'I'.
           l_s_range-opt  = 'EQ'.
          APPEND l_s_range TO e_t_range.
              ENDIF.
            ENDIF.
    endloop.
    ENDIF.
    Boujema

  • SSAS Tabular in DirectQuery - What are the workarounds for formula limitations?

    Hello,
    I need to create an SSAS Tabular model against the database of a live, real-time, line of business transactional system (i.e. a CRM).
    The business requirement behind it is that we need to create some complex reports against live data, and our DW is only updated daily.
    This live model will however be partitioned with a time-variance limitation (e.g. only records which are XX old can be returned).
    Now here is the challenge. Since I am querying live data, then I believe the model must be configured in DirectQuery model. Am I right?
    The issue is that DirectQuery mode is full of formula limitations. So my concern is, if I need a calculated column or measure that I cannot make it work due to DirectQuery limitations, then what are the alternatives?
    Remember that the data source is from a live system, so it is not like I can create columns and measures in the underlying relational database.
    Please advise.
    Regards,
    P.

    Hi pmdci,
    According to your description, you want to use some functions in calculated measure which are not supported in DirectQuery mode. Right?
    In Analysis Services Tabular, since DirectQuery has the real time access and scalability, this comes with a price of restrictions on a number of DAX functions and missing Calculated Column feature. Generally the workaround for these scenarios
    is replacing those functions with other functions which are supported in DirectQuery mode, or create columns in the data source. However, as you said, your environment is not possible to create columns in the database. And a lot of those limited
    function are not replaceable, like time intelligence functions. So actually, there's no really effective workaround currently.
    For you requirement, I suggest you submit Microsoft a feature request
    at https://connect.microsoft.com/SQLServer
    so that we can try to modify and expand the product features based on your needs.
    Best Regards,  
    Simon Hou
    TechNet Community Support

Maybe you are looking for

  • How to delete ABAP program of production environment

    Dear Experts, I have to delete a Z program, exists in production environment. But the program does not exist in development environment. Is this possible to delete the program using transport request? or other ways to delete the program in production

  • Install ODAC (11.2.0.2.30) Entity Framework and LINQ to Entities Failed

    Hi I am trying to install ODAC for Entity Framework & Link. But, while installing, there showed a message *"OS error, the Oracle MTS Recovery Service can't be started"*, and there were three choices, *"Ignore, Cancel, Retry"*. If I choose *"Cancel"*,

  • Slow down with iTunes 7 even if itunes isn't running?

    I've read a number of posts here and elsewhere that iTunes 7 can eat up system resources and slowdown your computer. However, I've been having problems even when iTunes isn't running. As in my copy of photoshop stutters and hangs a lot, even when doi

  • How can i improve the batterylife?(iPad 2)

    Could you help me?

  • Form access

    Hey guys, Sorry for another newbie question but I have been trying to make a form that will give the user the choice of which other forms they want to view but will also allow them ot select if they want to just have a mode where they can query the d