Can This Be Done? (Percentages)

  • Hi.  I a database that holds customers, order date, and order type.

    Customer  Order Date  Order Type

    0001          01012007        1

    0001          01032007        2

    0001          01052007         1

    What I would like to do is give a percentage of order type over a period of the last 6 order dates.  Between 01/01/2007 and 01/15/2007 say the last 6 orders, what percentage was order type 1, 2, then 3.  I wouldn't mind if it was set up like Excel so column one was customer, column 2-7 were dates, and column 8 was % of type 1, 9 was % of type 2, and 10 was % of type 3.

    Is this easily done in reporting services?

     

    Thanks!

  • Are you wanting to do this for a range of dates, or specifically only for the last six orders, no matter how many days elapsed between the first and last order? I assumed it was six orders, but then you tossed in "Between 01/01/2007 and 01/15/2007" and I was no longer sure. If the former, there are several ways of accomplishing this, depending on the range of days in a specific period. For example, if you want to go back a week, then you could group by the week and year, for example.

    If the latter, there are a few hurdles, and while I think you could overcome them in RS, I think you'd find it easier to do on the database side in most cases. There are some "gotchas" to be aware of as well. For example, if you have "ties", i.e. multiple orders on the same day, which one would you use in your calculation. If you had time as well, you could always pick the most recent one, but I don't see time in your sample data.

     

  • It would always be on the last 6 orders, but the date ranges are not set.  So they could order monday, tuesday, wednesday, but not again until say sunday.  So, there isn't a pattern there.  Also, they only order once per day.

  • So the last 6 orders completely regardless of the date?

  • Last 6 orders, regardless of the date chosen.

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

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