![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Thread-Topic: AS2005 Distinct Count on Dimension Table thread-index: AcXj7tiMpkfqb+o+RUOIU+L/g2KkvQ== X-WBNR-Posting-Host: 203.202.23.100 From: "=?Utf-8?B?QWNpdXM=?=" <acius (AT) nospam (DOT) nospam Subject: AS2005 Distinct Count on Dimension Table Date: Mon, 7 Nov 2005 14:59:02 -0800 Lines: 29 Message-ID: <B67CD4CB-733D-4139-B1BA-415E7EDDAF4E (AT) microsoft (DOT) com MIME-Version: 1.0 Content-Type: text/plain; charset="Utf-8" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 Content-Class: urn:content-classes:message Importance: normal Priority: normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 Newsgroups: microsoft.public.sqlserver.olap NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250 Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.sqlserver.olap:16027 X-Tomcat-NG: microsoft.public.sqlserver.olap Is there a way of including a Distinct Count on Dimension Table in the measures? e.g. Fact Table Employee PayrunId HoursWorked StandardHours Dimension Table PayrunId PayrunDate Month Year The Dimension table can be mde into a hierachy Year=>Month=>PayrunDate This can be used for adding hours over months or years. What I'm trying to do is get the average over time. e.g. SUM(HoursWorked/StandardHours)/CountDistinct(Dimension Table.PayrunId) Where CountDistinct(Dimension Table.PayrunId) is the number of pays in the year or month (as opposed to the number in the fact table) e.g. If an employee has a record for 2 out of 3 pays in a month they would be 0.66 Thanks |
#3
| |||
| |||
|
|
Hi, There seems a design issue on this cube. I think it shall be: Fact Table Month Year PayrunDate PayrunId Employee HoursWorked StandardHours Dimension Table1 PayrunID PayrunDate Month Year You may want to add a additional column with the same value as PayrunId, use this PayrunID as a measure, and select Aggregate function to "distinct count'. Regards, Peter Yang MCSE2000/2003, MCSA, MCDBA Microsoft Online Partner Support When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== === This posting is provided "AS IS" with no warranties, and confers no rights. -------------------- | Thread-Topic: AS2005 Distinct Count on Dimension Table | thread-index: AcXj7tiMpkfqb+o+RUOIU+L/g2KkvQ== | X-WBNR-Posting-Host: 203.202.23.100 | From: "=?Utf-8?B?QWNpdXM=?=" <acius (AT) nospam (DOT) nospam | Subject: AS2005 Distinct Count on Dimension Table | Date: Mon, 7 Nov 2005 14:59:02 -0800 | Lines: 29 | Message-ID: <B67CD4CB-733D-4139-B1BA-415E7EDDAF4E (AT) microsoft (DOT) com | MIME-Version: 1.0 | Content-Type: text/plain; | charset="Utf-8" | Content-Transfer-Encoding: 7bit | X-Newsreader: Microsoft CDO for Windows 2000 | Content-Class: urn:content-classes:message | Importance: normal | Priority: normal | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 | Newsgroups: microsoft.public.sqlserver.olap | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250 | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl | Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.sqlserver.olap:16027 | X-Tomcat-NG: microsoft.public.sqlserver.olap | | Is there a way of including a Distinct Count on Dimension Table in the | measures? | | e.g. | Fact Table | Employee | PayrunId | HoursWorked | StandardHours | | Dimension Table | PayrunId | PayrunDate | Month | Year | | The Dimension table can be mde into a hierachy | Year=>Month=>PayrunDate | | This can be used for adding hours over months or years. | What I'm trying to do is get the average over time. | | e.g. SUM(HoursWorked/StandardHours)/CountDistinct(Dimension Table.PayrunId) | Where CountDistinct(Dimension Table.PayrunId) is the number of pays in the | year or month (as opposed to the number in the fact table) | e.g. If an employee has a record for 2 out of 3 pays in a month they would | be 0.66 | | Thanks | |
#4
| |||
| |||
|
|
Thread-Topic: AS2005 Distinct Count on Dimension Table thread-index: AcXkrqg1Ibzds2fSTsKTsdgQRn+/XQ== X-WBNR-Posting-Host: 203.202.23.100 From: "=?Utf-8?B?QWNpdXM=?=" <acius (AT) nospam (DOT) nospam References: <B67CD4CB-733D-4139-B1BA-415E7EDDAF4E (AT) microsoft (DOT) com Y2cjy$D5FHA.3292 (AT) TK2MSFTNGXA01 (DOT) phx.gbl Subject: RE: AS2005 Distinct Count on Dimension Table Date: Tue, 8 Nov 2005 13:52:04 -0800 Lines: 109 Message-ID: <57D95954-1B45-44F7-8105-8E31A3018696 (AT) microsoft (DOT) com MIME-Version: 1.0 Content-Type: text/plain; charset="Utf-8" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 Content-Class: urn:content-classes:message Importance: normal Priority: normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 Newsgroups: microsoft.public.sqlserver.olap NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250 Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA02.phx.gbl!TK2MSF TNGXA03.phx.gbl Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.sqlserver.olap:16057 X-Tomcat-NG: microsoft.public.sqlserver.olap Hi Peter, The dimension table has details of all pay runs. (Like a time dimension has details of all time periods) In the fact table the employee may have only been paid for 2 of the 3 pays in a month so should only register 2/3. i.e. I need to do a distinct count on something not in the fact table Cheers "Peter Yang [MSFT]" wrote: Hi, There seems a design issue on this cube. I think it shall be: Fact Table Month Year PayrunDate PayrunId Employee HoursWorked StandardHours Dimension Table1 PayrunID PayrunDate Month Year You may want to add a additional column with the same value as PayrunId, use this PayrunID as a measure, and select Aggregate function to "distinct count'. Regards, Peter Yang MCSE2000/2003, MCSA, MCDBA Microsoft Online Partner Support When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== === This posting is provided "AS IS" with no warranties, and confers no rights. -------------------- | Thread-Topic: AS2005 Distinct Count on Dimension Table | thread-index: AcXj7tiMpkfqb+o+RUOIU+L/g2KkvQ== | X-WBNR-Posting-Host: 203.202.23.100 | From: "=?Utf-8?B?QWNpdXM=?=" <acius (AT) nospam (DOT) nospam | Subject: AS2005 Distinct Count on Dimension Table | Date: Mon, 7 Nov 2005 14:59:02 -0800 | Lines: 29 | Message-ID: <B67CD4CB-733D-4139-B1BA-415E7EDDAF4E (AT) microsoft (DOT) com | MIME-Version: 1.0 | Content-Type: text/plain; | charset="Utf-8" | Content-Transfer-Encoding: 7bit | X-Newsreader: Microsoft CDO for Windows 2000 | Content-Class: urn:content-classes:message | Importance: normal | Priority: normal | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 | Newsgroups: microsoft.public.sqlserver.olap | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250 | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl | Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.sqlserver.olap:16027 | X-Tomcat-NG: microsoft.public.sqlserver.olap | | Is there a way of including a Distinct Count on Dimension Table in the | measures? | | e.g. | Fact Table | Employee | PayrunId | HoursWorked | StandardHours | | Dimension Table | PayrunId | PayrunDate | Month | Year | | The Dimension table can be mde into a hierachy | Year=>Month=>PayrunDate | | This can be used for adding hours over months or years. | What I'm trying to do is get the average over time. | | e.g. SUM(HoursWorked/StandardHours)/CountDistinct(Dimension Table.PayrunId) | Where CountDistinct(Dimension Table.PayrunId) is the number of pays in the | year or month (as opposed to the number in the fact table) | e.g. If an employee has a record for 2 out of 3 pays in a month they would | be 0.66 | | Thanks | |
#5
| |||
| |||
|
|
Is there a way of including a Distinct Count on Dimension Table in the measures? e.g. Fact Table Employee PayrunId HoursWorked StandardHours Dimension Table PayrunId PayrunDate Month Year The Dimension table can be mde into a hierachy Year=>Month=>PayrunDate This can be used for adding hours over months or years. What I'm trying to do is get the average over time. e.g. SUM(HoursWorked/StandardHours)/CountDistinct(Dimension Table.PayrunId) Where CountDistinct(Dimension Table.PayrunId) is the number of pays in the year or month (as opposed to the number in the fact table) e.g. If an employee has a record for 2 out of 3 pays in a month they would be 0.66 Thanks |
#6
| |||
| |||
|
|
Is there a way of including a Distinct Count on Dimension Table in the measures? e.g. Fact Table Employee PayrunId HoursWorked StandardHours Dimension Table PayrunId PayrunDate Month Year The Dimension table can be mde into a hierachy Year=>Month=>PayrunDate This can be used for adding hours over months or years. What I'm trying to do is get the average over time. e.g. SUM(HoursWorked/StandardHours)/CountDistinct(Dimension Table.PayrunId) Where CountDistinct(Dimension Table.PayrunId) is the number of pays in the year or month (as opposed to the number in the fact table) e.g. If an employee has a record for 2 out of 3 pays in a month they would be 0.66 Thanks |
#7
| |||
| |||
|
|
have you try to use 2 cubes + 1 virtual? from what I understand, you want to compare real values with planned or possible values. (real payrun by employee versus planned payrun by employee) 1 with the real number of payrun by employee (simple sum or count measure) the second is the number of payrun planned by month, and the number of payrun * nb of employees (which provide the total number of payrun-employee for the month) (this cube doesn't include the employee dimension, but you could include it) create a virtual cube based on these 2 cubes. In your sample, the cube 1 provide 2 payrun for the employee, the second cube display 3 planned payruns, result = 2/3 "Acius" <acius (AT) nospam (DOT) nospam> wrote in message news:B67CD4CB-733D-4139-B1BA-415E7EDDAF4E (AT) microsoft (DOT) com... Is there a way of including a Distinct Count on Dimension Table in the measures? e.g. Fact Table Employee PayrunId HoursWorked StandardHours Dimension Table PayrunId PayrunDate Month Year The Dimension table can be mde into a hierachy Year=>Month=>PayrunDate This can be used for adding hours over months or years. What I'm trying to do is get the average over time. e.g. SUM(HoursWorked/StandardHours)/CountDistinct(Dimension Table.PayrunId) Where CountDistinct(Dimension Table.PayrunId) is the number of pays in the year or month (as opposed to the number in the fact table) e.g. If an employee has a record for 2 out of 3 pays in a month they would be 0.66 Thanks |
![]() |
| Thread Tools | |
| Display Modes | |
| |