![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
Well this really all depends on how you want to accomplish the task. Do you want to do this on the OLAP side or do you want to do this on the ETL side. Personally, I would do it in the ETL, but since you were asking from some kind of calc member I will go the OLAP route. By looking at your sample data set I am assuming that for every iteration of an OrderID in your fact table the Hours column will be the same number. If this isn't the case then this approach won't work, but here you go. All you should have to do is set the Aggregate Function (found in the measure properties in the cube editor) for your measure (in this case Hours) to the MAX function. This will basically look at your query for hours and based on your criteria will choose the largest number of hours spent. Since (and again the assumption) all of the numbers for an OrderID are the same this will pull back the right number. If my assumption above is incorrect let me know and I can post a different solution for you. V |
#4
| |||
| |||
|
|
I have the following data in my olap cube OrderID Hours DateInvoiceSent BillAmt 1 200 1/1/04 $10 1 200 2/1/04 $20 1 200 3/1/04 $30 1 200 4/1/04 $40 2 100 1/1/04 $10 2 100 2/1/04 $20 2 100 3/1/04 $30 OrderID: the ID of the order Hours: the number of hours it took to process a order DateInvoiceSent: the date that an invoice was sent to a client. We send multiple invoices on several different dates for a single order. The problem is when I use a Excel PivotTable to look at this data, asking for the orderID and the number of hours spent processing the order. I get the following OrderID Hours 1 800 (4*200) 2 300 (3*100) This is incorrect since there were only 200 hours spent processing order #1. What I wish I could get is OrderID Hours 1 200 2 100 Does anyone know of a way to write a calculated measure that would return the correct value for hours? Perhaps by correcting by the number of bills sent? P.S. I think this problem is basically caused by having measures resides that too different levels of the heirarchy, the orders level and the invoice level |
#5
| |||
| |||
|
|
Hi number of hours it took to process a order is attribute of the Order not of the Fact, therefor it belongs Order dimension as Attribute. Than you can build a calculated measure, based on dimesion property iif (IsLeaf(Order.CurrentMember), Order.Properties("Hours"), null ... or smth. else) Vladimir Chtepa "J" <A@b.c> schrieb im Newsbeitrag news:u2ydz7gHGHA.2896 (AT) TK2MSFTNGP09 (DOT) phx.gbl... I have the following data in my olap cube OrderID Hours DateInvoiceSent BillAmt 1 200 1/1/04 $10 1 200 2/1/04 $20 1 200 3/1/04 $30 1 200 4/1/04 $40 2 100 1/1/04 $10 2 100 2/1/04 $20 2 100 3/1/04 $30 OrderID: the ID of the order Hours: the number of hours it took to process a order DateInvoiceSent: the date that an invoice was sent to a client. We send multiple invoices on several different dates for a single order. The problem is when I use a Excel PivotTable to look at this data, asking for the orderID and the number of hours spent processing the order. I get the following OrderID Hours 1 800 (4*200) 2 300 (3*100) This is incorrect since there were only 200 hours spent processing order #1. What I wish I could get is OrderID Hours 1 200 2 100 Does anyone know of a way to write a calculated measure that would return the correct value for hours? Perhaps by correcting by the number of bills sent? P.S. I think this problem is basically caused by having measures resides |
#6
| |||
| |||
|
#7
| |||
| |||
|
|
Looking back on it, I have to agree with both Vladimir and Darren, this would definitely be better done outside the fact table. And in AS2K, Vlad's solution will work very well. However, if you plan on going to AS2K5 anytime soon keep in mind that there is no longer the concept of member properties. You will have to include hours as an attribute. However, if you are in AS2K for a while, there is no reason to borrow trouble. V |
#8
| |||
| |||
|
|
Hi number of hours it took to process a order is attribute of the Order not of the Fact, therefor it belongs Order dimension as Attribute. Than you can build a calculated measure, based on dimesion property iif (IsLeaf(Order.CurrentMember), Order.Properties("Hours"), null ... or smth. else) Vladimir Chtepa "J" <A@b.c> schrieb im Newsbeitrag news:u2ydz7gHGHA.2896 (AT) TK2MSFTNGP09 (DOT) phx.gbl... I have the following data in my olap cube OrderID Hours DateInvoiceSent BillAmt 1 200 1/1/04 $10 1 200 2/1/04 $20 1 200 3/1/04 $30 1 200 4/1/04 $40 2 100 1/1/04 $10 2 100 2/1/04 $20 2 100 3/1/04 $30 OrderID: the ID of the order Hours: the number of hours it took to process a order DateInvoiceSent: the date that an invoice was sent to a client. We send multiple invoices on several different dates for a single order. The problem is when I use a Excel PivotTable to look at this data, asking for the orderID and the number of hours spent processing the order. I get the following OrderID Hours 1 800 (4*200) 2 300 (3*100) This is incorrect since there were only 200 hours spent processing order #1. What I wish I could get is OrderID Hours 1 200 2 100 Does anyone know of a way to write a calculated measure that would return the correct value for hours? Perhaps by correcting by the number of bills sent? P.S. I think this problem is basically caused by having measures resides that too different levels of the heirarchy, the orders level and the invoice level |
#9
| |||
| |||
|
|
Hi I started trying to use your suggestion and it appears to be working except for the totals. I understand how to retrieve the member property for a leaf but I don't understand what to do if it is not a leaf. How to do I add up all the member properties for the children of a member? iif( IsLeaf([Order ID].currentmember), val([Order ID].Properties("Hours")), sum( val([Order ID].children.Properties("Hours")) ) ) I don't think the last part of my iif function is valid MDX syntax. What would be the valid equivalent? "Vladimir Chtepa" <vc.nospam (AT) diacom-systemhaus (DOT) nospam.de> wrote in message news:eZyov$OIGHA.1288 (AT) TK2MSFTNGP09 (DOT) phx.gbl... Hi number of hours it took to process a order is attribute of the Order not of the Fact, therefor it belongs Order dimension as Attribute. Than you can build a calculated measure, based on dimesion property iif (IsLeaf(Order.CurrentMember), Order.Properties("Hours"), null ... or smth. else) Vladimir Chtepa "J" <A@b.c> schrieb im Newsbeitrag news:u2ydz7gHGHA.2896 (AT) TK2MSFTNGP09 (DOT) phx.gbl... I have the following data in my olap cube OrderID Hours DateInvoiceSent BillAmt 1 200 1/1/04 $10 1 200 2/1/04 $20 1 200 3/1/04 $30 1 200 4/1/04 $40 2 100 1/1/04 $10 2 100 2/1/04 $20 2 100 3/1/04 $30 OrderID: the ID of the order Hours: the number of hours it took to process a order DateInvoiceSent: the date that an invoice was sent to a client. We send multiple invoices on several different dates for a single order. |
![]() |
| Thread Tools | |
| Display Modes | |
| |