Working with IcCube 6.8, I Have a Hierarchy called [Pole_UM_UF_PH].[Pole_UM_UF (PH)] with 4 levels as following :
Pole
Structure
UM
UF
Using MDX, I want to show only Poles and their UM (possibly the ALL-M on TOP, but not the Structure nor UF)
I tried using following MDX but it permits to drill on Structure and UF.
select [Measures].[Nb RUM] on 0,
non empty {[Pole_UM_UF_PH].[Pole_UM_UF (PH)].[All-M] + [Pole_UM_UF_PH].[Pole_UM_UF (PH)].[Pole] + [Pole_UM_UF_PH].[Pole_UM_UF (PH)].[UM]} on 1
from [Cube]
Is there a way to do that without recreating a new Hierarchy containing only Pole and UM ?
I do not think this is possible without creating a new hierarchy.
Even using a perspective hiding the level [Structure] would mean the level [UF] is not visible anymore.
Related
Given 3 dimentions DimA and DimB and DimC with some DimSk, DimId and DimName as attributes the problem is defined as "add to cube new attribute which is calculated as":
NewAttr =
CASE
WHEN DimC.DimId IN (1, 2, 3) THEN 'A ' + DimA.DimName
WHEN DimC.DimId IN (4, 5, 6) THEN 'B ' + DimB.DimName
END
All dimentions are referenced directly from Fact by SKs.
How would You solve this in multidim SSAS cube?
!Warning! Spoilers below - try to think about solution before reading about my!
My current approach is to calculate CROSS JOIN (~100x100x100) beetween Dims IDs.
Then I can calculate composite NK for DimNew as ID ~ DimA.DimId+|+DimB.DimId+|+DimC.DimId.
Then I can add this ID to Fact ETLs too, and build new ETL for new dim with NewAttr as expected.
Then I can add in cube new dim and add new fact column and join them by ID/SK.
Should work, or is there 10x better solution?
Final Fact can be like:
FactId, DimASK, DimBSK, DimCSK, DimNewSK
or
FactId, DimASK, DimBSK, DimCSK, NewAttr
second one is fast and dirty without NewDim on db - but fact can be processed partially so distinct can produce different NewAttr for same composite NK when DimNamein dims will change in time...
Okey dokey!
Seems like if You have all SKs in Fact then add new dimention with all needed, then calculate NewAtr, and then make new Dim in cube with all SKs as composite key - its key step.
Its important to not use DimNewSK from new dim from identity or something as key in cube.
Composite Key allows to make simple regular relation to fact and works without additional dummy keys.
Pictures are 1000s of words - its as simple as looks after all:
Looks like a silly question, but I can't find a way to access the DataViews in my DataViewManager.
I can see it in the DataViewManager Visualizer window, so there must be a way.
What am I doing wrong?
dvm = New DataViewManager(MyDS) ''-- MyDS is a strongly typed dataset
dvm.CreateDataView(MyDS.Company)
dvm.CreateDataView(MyDS.Sites)
MsgBox(dvm.DataViewSettings.Count) ''-- shows 7, even though I added only 2.
For Each view As DataView In dvm ''-- Error!
MsgBox(view.Table.TableName)
Next
I also observed that irrespective of how many DataViews I create, data the DataViewManager Visualizer shows all DataViews in my dataset. Why?
how do I hide those rows in parent whose child data view returns 0 rows after applying RowFilter on child
I've done it like this, but it feels like a nasty hack; I've never read the source deeply enough to know if there is a better way:
Add a column to your child datatable: Name: IsShowing, Type: Int, Expression: 1, ReadOnly: True
Put the following code:
ChildBindingSource.RemoveFilter()
ParentBindingSource.RemoveFilter()
YourDataSet.ChildDataTable.IsShowingColumn.Expression = ""
YourDataSet.ChildDataTable.Expression = $"IIF([SomeColumn] Like '{SomeFilterText}',1,0)"
ChildBindingSource.Filter = "[IsShowing] > 0"
ParentBindingSource.Filter = "Sum(Child.IsShowing) > 0"
The removal and re-add triggers a re-evaluation of the expression and the filters. There is probably a way to do this without removing/re-adding but I haven't yet found it.. Expressions are normally only re-evaluated when row data changes; changing an expression doesn't seem to recalculate all the row values/trigger a refresh of the relations and BS filters
It would be great if the parent filter supported complex expressions like SUM(IIF(Child.SomeColumn = 'SomeFilter',1,0)>0 but the SUM operator expects only a column name in the parent or child. As such, the circuitous route of having a column with an Expression be the part inside the SUM is the only way i've found to leverage the built in filtering
Remember when you test that the search is case sensitive. If you want it not to be you might have to have another column of data that is the lowercase version of what you want to search and lowercase your query string
I have been working on a custom dll (that is called via a custom xll / Excel Addin) to construct MDX and return 2D data.
It's working nicely and I just went to work out how I add the ability to send in an exclusion list using EXCEPT.
I built up a query with filtering and this query works except it ignores the EXCEPT. Anyone with more MDX than me (I'm about 2 months in haha :)) know why?
Thanks
Leigh
WITH
Member [Measures].[Book_Label] AS [Book].[Book].CURRENTMEMBER.MEMBER_CAPTION
Member [Measures].[Isin_Label] AS [Isin].[Isin].CURRENTMEMBER.MEMBER_CAPTION
SELECT
NON EMPTY
{[Measures].[Book_Label],[Measures].[Isin_Label],[Measures].[Notional.SUM]}
ON COLUMNS,
NON EMPTY ORDER
(
EXCEPT(
FILTER(
([Book].CHILDREN,[Isin].CHILDREN),
([Book].[Book].CURRENTMEMBER.MEMBER_CAPTION = "ALGO1")
),
[Isin].[Isin].[DE0001104776]),
[Notional.SUM]
,
BASC)
ON ROWS
FROM[TraderCube]
WHERE ([Date].[Date].[2019-11-18])
That is nice progress in two months. A humble piece of advise, you should always specify your problem in simple words along with the code developed so far. That helps the person answering.
Form your code, my understanding is you want "ALGO1" books with all members of [ISin] except the member "DE0001104776". Based on this understanding use the code below
NON EMPTY
ORDER
(
([Book].[Book].[ALGO1],{[Isin].[Isin].children-[Isin].[Isin].[DE0001104776]}),
[Notional.SUM],
BASC
)
I returned to trying out combining my currently working 1..n FILTER builder in conjunction with an EXCEPT (requested by business). Unfortunately, despite the query passing syntax check and executing, as reported in original post the cube/server ignores it.
I just tried adding a <> to my FILTER and it worked! :)
Here's an example.
WITH
Member [Measures].[Book_Label] AS [Book].[Book].CURRENTMEMBER.MEMBER_CAPTION
Member [Measures].[Isin_Label] AS [Isin].[Isin].CURRENTMEMBER.MEMBER_CAPTION
SELECT
NON EMPTY {[Measures].[Book_Label],[Measures].[Isin_Label],[Measures].[Notional.SUM]}
ON COLUMNS,
NON EMPTY
ORDER(
FILTER(
([Book].CHILDREN,[Isin].CHILDREN),
(([Book].[Book].CURRENTMEMBER.MEMBER_CAPTION = \"ALGO1\") AND
([Isin].[Isin].CURRENTMEMBER.MEMBER_CAPTION <> \"DE0001102309\"))
),[Notional.SUM],
BASC)
ON ROWS
FROM[TraderCube]
WHERE([Date].[Date].[2019-11-21])
I will make this question and scenario as basic as possible since I have no background on programming. How do I make a script where all red will be multiplied by 5, yellow by 6 and blue by 7? The new measure will aggregate in grand total. I don't know what expressions to use. Just use [Product] for the colors and [Measure] for qty.
enter image description here
I dont understand yet the use of MEMBERS and other expressions as this is my first time to be on it. I tried
([Measure].[Quantity],[Product].&[Yellow])*6
but it will just multiply everything with 6. Maybe FILTERS? IIF? I just don't know how. The script will go a long way when I will apply it in our database. thanks!
I know you asked about doing this with excel, but if you were writing an MDX query you could do create a new measure and run the query like this:
WITH
member measures.[ColorQuantity] AS CASE WHEN [Product].[Product].currentmember.member_key = "Yellow" THEN measures.[Quantity] * 6
WHEN [Product].[Product].currentmember.member_key = "Blue" THEN measures.[Quantity] * 5
WHEN [Product].[Product].currentmember.member_key = "Red" THEN measures.[Quantity] * 2
ELSE measures.[Quantity] END
SELECT {
measures.[Quantity], measures.[ColorQuantity]
} ON 0,
Non EMPTY
{
[Product].[Product].[All].Children /// I dont know the FULL dimension AND hierarchy path you want TO use
} ON 1
FROM YourCubeName
This might help you get started.
I am trying to untangle a complicated multi language Drupal site with custom SQL reports.
By poking around I bit I was able to construct this SQL statement which gives me all nodes and helps me find translation relationships.
SELECT node.nid as node_nid, node.language as node_language,
node.type as node_type, node.title as node_title,
node.tnid as node_tnid, node.status as node_status, url.src,
url.dst, url.language as url_language
FROM {node} as node
LEFT JOIN {url_alias} as url
ON url.src = CONCAT('node/', node.nid)
ORDER BY node_type, node_language, node.nid
Now I want to add 'permitted input formats' and publishing options for each node. Also list all menus and what they contain.
You may want to look at the views module, it can save you a lot of time and save you writing custom SQL.