![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi I am doing a distinct count of a measure and at each level it is 1 more than the count. Seems like it is counting NULL value also. Can someone help me to solve this? Thank you *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#3
| |||
| |||
|
|
Let's suppose next some fact records. EmpID ProdID Sales Cost Const(Dummy) ---------------------------------------- 1 1 100 100 1 1 2 NULL 100 1 2 1 NULL 100 1 2 2 NULL 100 1 2 3 300 100 1 Case of EmpID 1, SumOfConst is 2 and CountOfSales is 1. Case of EmpID 2, SumOfConst is 3 and CountOfSales is 1. Case of ProdID 1, SumOfConst is 2 and CountOfSales is 1. Case of ProdID 2, SumOfConst is 2 and CountOfSales is 0. Case of ProdID 3, SumOfConst is 1 and CountOfSales is 1. -> No null Case of All, SumOfConst is 5 and CountOfSales is 2. So, if both of the results are not same, it means there is more than one NULL. Your case might have more things considered but I hope next logical expression could be helpful. IIF(SumOfConst = CountOfSales, DistinctCount, DistinctCount - 1) Ohjoo Kwon www.olapforum.com "ram lakshman" wrote: Hi I am doing a distinct count of a measure and at each level it is 1 more than the count. Seems like it is counting NULL value also. Can someone help me to solve this? Thank you *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#4
| |||
| |||
|
|
Analysis Services 2000 does not support NULLS as you would expect it in a relational RDBMS with 3-level logic. It simply converts all NULLs to zeros. Thus they will be counted (as you are seeing). BTW: this is not true with 2005 -- there we support NULLs and unknown members. -- Dave Wickert [MSFT] dwickert (AT) online (DOT) microsoft.com Program Manager BI SystemsTeam SQL BI Product Unit (Analysis Services) -- This posting is provided "AS IS" with no warranties, and confers no rights. "Ohjoo Kwon" <Ohjoo Kwon (AT) discussions (DOT) microsoft.com> wrote in message news:E85AB7D1-EE87-4C1F-96A4-441055DEC338 (AT) microsoft (DOT) com... Let's suppose next some fact records. EmpID ProdID Sales Cost Const(Dummy) ---------------------------------------- 1 1 100 100 1 1 2 NULL 100 1 2 1 NULL 100 1 2 2 NULL 100 1 2 3 300 100 1 Case of EmpID 1, SumOfConst is 2 and CountOfSales is 1. Case of EmpID 2, SumOfConst is 3 and CountOfSales is 1. Case of ProdID 1, SumOfConst is 2 and CountOfSales is 1. Case of ProdID 2, SumOfConst is 2 and CountOfSales is 0. Case of ProdID 3, SumOfConst is 1 and CountOfSales is 1. -> No null Case of All, SumOfConst is 5 and CountOfSales is 2. So, if both of the results are not same, it means there is more than one NULL. Your case might have more things considered but I hope next logical expression could be helpful. IIF(SumOfConst = CountOfSales, DistinctCount, DistinctCount - 1) Ohjoo Kwon www.olapforum.com "ram lakshman" wrote: Hi I am doing a distinct count of a measure and at each level it is 1 more than the count. Seems like it is counting NULL value also. Can someone help me to solve this? Thank you *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#5
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |