Showing posts with label items. Show all posts
Showing posts with label items. Show all posts

Monday, March 26, 2012

Ragged Hierarchy / Unbalanced Hierarchy - whats the difference and how do i process it ?

Q1) what is the difference between a ragged hierarchy and an unbalanced hierarchy ?

Q2)

I have a structure for items in the store

Each item can be classified into

Category

SubCategory

Class

Most items go down all three levels

but some are only classified into the top two categories

and a few are only classified in the Category classification

i have tried to create a Hierarchy for this

but when i review the results in the browser, it will only show me the results of the items that are classified to the bottom level - it does NOT show me the ones that are classified in only the top one or two levels

according to BOL

"To make a parent-child hierarchy ragged, use the SkippedLevelsColumn property of the parent attribute in the hierarchy to support the ragged structure."

but i have found that this has been removed from AS2005

(http://msdn2.microsoft.com/en-us/library/ms143229.aspx)

Skipped levels in parent-child hierarchies

The SkippedLevelsColumnproperty, which indicates how many levels to skip when creating a member under a parent in a parent-child hierarchy, is no longer supported.

so - how can this be done ?

Hello! To me a ragged or unbalanced hierarchy is the same.

You control this on each level in the user hierarchy in the dimension editor. Click on a level in the hiearchy and check the property "HideMemberIf"

Parent-Child dimensions is a different case because they have unnamed, recursive levels. Ragged and Unbalanced Hierarchies have named levels but with missing members or values in each level in the user hierarchy.

HTH

Thomas Ivarsson

|||

Thomas

thx for this

but can you please explain a bit more

i have set the HideMemberIf property on both the SubCategory and Class description to NoName - and this hides the blank entries (as expected)

But

when i put attribute relationships between the SubCategory and Category and between the SubCategory and Class onto the hierarchy (in the Hierarchies and Levels panel), then the original problem arises in that the entries are not shown in the cube browser

m

|||

Hello again. I have checked the Geography dimension and the Geography-hierarchy in the Adventure Works sample cube that is part of the installation of SQL Server 2005.

In this hierarchy you have the levels Country-StateProvince-City-PostalCode all with attribute relations to the parent and a HideMemberIf-property set to NoName on the StateProvince level. United Kingdom have no members in the StateProvince-level, like you can see in the browser. All other countries have. This example works as you expect so you must have another problem in your dimension.

The HideMemberIf-property will not be supported in the next release of SQL Server, according to books on line.

HTH

Thomas Ivarsson

Friday, March 9, 2012

quick SELECT statement question

Hello all!
I have a date/time column on my table. How can I write a select statement
to pick only items from todays date? I looked, but can't find an answer.
SELECT * User FROM TABLE WHERE datecolumn = "todays date"
Thanks!
RudySELECT
*
FROM
Table
WHERE
CONVERT(CHAR(8), datecolumn, 112) = CONVERT(CHAR(8),
GETDATE(), 112)
Due to the time that is stored in a datatime datatype, you need to strip the
time out as above.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Rudy" <Rudy@.discussions.microsoft.com> wrote in message
news:5E70E4E8-EB91-4DBF-8489-5F9E3A5A204C@.microsoft.com...
> Hello all!
> I have a date/time column on my table. How can I write a select statement
> to pick only items from todays date? I looked, but can't find an answer.
> SELECT * User FROM TABLE WHERE datecolumn = "todays date"
> Thanks!
> Rudy|||Hi Mike!
WOW!! I wouild have never figured that out. Thanks!!
Rudy
"Mike Epprecht (SQL MVP)" wrote:

> SELECT
> *
> FROM
> Table
> WHERE
> CONVERT(CHAR(8), datecolumn, 112) = CONVERT(CHAR(8),
> GETDATE(), 112)
> Due to the time that is stored in a datatime datatype, you need to strip t
he
> time out as above.
> Regards
> --
> Mike Epprecht, Microsoft SQL Server MVP
> Zurich, Switzerland
> IM: mike@.epprecht.net
> MVP Program: http://www.microsoft.com/mvp
> Blog: http://www.msmvps.com/epprecht/
> "Rudy" <Rudy@.discussions.microsoft.com> wrote in message
> news:5E70E4E8-EB91-4DBF-8489-5F9E3A5A204C@.microsoft.com...
>
>|||Hi
Or
SELECT
*
FROM
Table
WHERE
datecolumn >= (CONVERT(CHAR(8), GETDATE(), 112) + '
00:00:00.000'
AND datecolumn <= (CONVERT(CHAR(8), GETDATE(), 112) + '
23:59:59.997'
The 1st one can not use an index if that is the only predicate in the where
clause as each row needs to be evaluated.
The 2nd one could use an index, but make sure that you use ' 23:59:59.997'
and not ' 23:59:59.999' as .999 can not be represented in datetime, so it
rounds itself to 00:00:00.000, the next day
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Rudy" <Rudy@.discussions.microsoft.com> wrote in message
news:2202B61C-5A3A-4FEB-B0E4-6FC0480FB1EA@.microsoft.com...
> Hi Mike!
> WOW!! I wouild have never figured that out. Thanks!!
> Rudy
> "Mike Epprecht (SQL MVP)" wrote:
>|||In addition to Mike's comments, you might want to red more about the subject
at:
http://www.karaszi.com/SQLServer/info_datetime.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Rudy" <Rudy@.discussions.microsoft.com> wrote in message
news:5E70E4E8-EB91-4DBF-8489-5F9E3A5A204C@.microsoft.com...
> Hello all!
> I have a date/time column on my table. How can I write a select statement
> to pick only items from todays date? I looked, but can't find an answer.
> SELECT * User FROM TABLE WHERE datecolumn = "todays date"
> Thanks!
> Rudy