Create a cursor for count days

  • Hello, can help me in the following situation:

    I have made a dimension as follows

    Users Phone Start_date End_date

    Bill 934867777 2000-01-01 2000-02-13

    Mark 934867777 2000-02-14 2000-02-28

    must create a cursor to tell how many days were in each record, that is, the phone user has changed in 02 months of 2000, need to know how many days this user in the first month and how many days was in the same month in another user, for This first have to determine whether the Start_date coincides with the years and months, coinciding case, then I q compare the end_date with start_date of users, because the same number of user switches in the same year and month, I have to know how many days was a and another user. Excuse my English is not my first language:), counting with your help.

    compliments

  • Are you trying to create another attribute for the dimension to show number of days or a calculation in the cube to handle this. I am not sure why you need the cursor exactly and why you just couldn't use the DATEDIFF function and handle the logic in this format to evaluate years. I guess I am confused a bit and maybe I am missing a step here in your explanation.

    ----------------------------------------------------------------------------------------
    Dan English - http://denglishbi.wordpress.com

  • The question is as follows, the number of phone has a combined monthly, and the phone can be passed from one person to another in the month, and in this case have to know the number of days in q was in each person, and then calculate the value the tuition fee depending on the number of days that were with each other.

    For example in May 2008 got a phone number and is taxed at a monthly figure of 20 usd for that month, but I get the phone just days before the May 12, on 13 the number that goes into another person and in this case the monthly rate can not taxed twice to go back to that person, I q do the calculation of the value depending on the day that he was with everyone, that is, the bill had with the phone in the month of May for 12 to 42 equals % Of the days of the month, representing the value x of the 20 usd

  • First, you don't need a cursor. Second, your description of the problem is a little difficult to follow. What would help you is to take the time to read the article that I have linked in my signature block below on "How to ask for help". Follow the instructions in that article and repost your question in this thread. Following those instructions will get you better responses that will actually help you solve your problem.

  • Hello, thank you anyway, I can not explain better, my english is not very good and then gets me a little hard to explain well, I will try to solve alone, thanks

    compliments

  • Doesn't mean you need better english, just better information. The DDL for the tables, sample data for the tables, expected results based on the sample data. All this adds a lot to the problem definition, and that is what the article shows you how to provide.

    We are more than willing to help, but we have to understand the problem to be of help.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply