-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TM1py returns hierarchy nodes in wrong “level” fields #476
Comments
Hi @carltoncheung, TM1py is just the messenger. It's forwarding the (MDX-) level names as they are defined in TM1.
This wouldn't be understood by PBI, because PBI expects the element-name to be in one fixed column. Here are some alternative ideas I'm not entirely sure if this is a viable suggestion for your situation, but you may have to break the dimension into consistent pieces. Perhaps you could also define custom attributes that reflect the structure that you would like to see in PBI. Then you could retrieve those attributes instead of the levels. Perhaps when doing this kind of TM1-typical analysis over custom ragged dimensions you may want to use a different front-end. I hope this helps Marius |
Hi @carltoncheung, I think there may be a better solution to dealing with ragged dimensions in PBI. So in your example, in the first row, we would repeat the
Would that suit your requirement? EDIT: With this approach, the hierarchy is more in line with what we would expect (coming from TM1) but the numbers on the sub-nods are inconsistent. Like |
Hi @MariusWirtz , Thanks for taking the time to reply and for your suggestions. I really appreciate it! Using the arc tool to test the TM1 APIs directly, we can see that the API follows the historical way that TM1 has labelled its hierarchy levels (level 0 = leaf node, and highest level is the top level root node): However the TM1py function Screenshot above shows that it is treating the leaf node (105120 - Petty Cash) as level 17, putting the leaf's parent (ARP - Cash on Hand) into "level016", the leaf's parent's parent (ARP - Cash & Cash Equivalents) into "level015", and so on. So there is definitely a discrepancy between the hierarchy level labels in TM1/API vs what TM1py function returns. Assuming this discrepancy is resolved, it still doesn't solve the problem for Power BI and ragged hierarchies. It appears that with Planning Analytics v2.x, TM1 is moving from the historical way of labelling hierarchy levels to the industry standard MDX way, which is to make the root node Level 0, and the leaf node the highest level number: The good news is that Power BI can handle ragged hierarchies perfectly well, as long as the hierarchy levels are labelled according to industry standard MDX way - i.e. root = level 0. We have used Power BI for reporting SAP hierarchies for several years now, and because the SAP connector follows root = level 0, it works perfectly even for ragged hierarchies. Now my question is, given that the function I had a quick look at the Thanks again, and happy to have a conference call to discuss if required. Kind regards, |
Hi @carltoncheung, thanks for your detailed answer. I appreciate the feedback on the PowerBI functionality. With regard to ascending and descending levels, TM1py is currently bringing through the MDX levels.
I am happy to hear that! Let's change the functions so that it can fulfill its primary purpose to support Power BI connectivity.
Please see my post above. #476 (comment) I sent you a connection request on LinkedIn. Happy to continue this conversation on Microsoft Teams or Zoom. |
Hi @MariusWirtz I think TM1py will bring back MDX levels (root=0) correctly, only if the hierarchy is balanced. If the hierarchy is ragged, like in my example above, the Image below shows a ragged hierarchy where the leaf node (105120 - Petty Cash) is only 6 levels away from the root, but it is treated as level 17 because the hierarchy has other leaf nodes which are 17 levels away from the root. The correct result would be that level005, level004, level003, level002, level001, level000 fields are populated with the parent nodes (and level016 - level006 fields are left blank). Thanks, |
Hi @carltoncheung, I understand that the levels need to be aligned "on the right" in order for PBI to aggregate.
|
Hi @carltoncheung, thanks for the catch. I shifted one column too much (in your case the last attribute: Please upgrade and test again. |
Hi Marius, All fixed now. Thanks! Happy to close this issue. Kind regards, |
Thanks |
Describe what did you try to do with TM1py
I am trying to get dimension data (with hierarchy) from TM1, to use in Power BI reports. The python script I used is:
Describe what's not working the way you expect
For each leaf node in the hierarchy, I expected each of its parent nodes to be returned in a field that corresponds to the level in the hierarchy the parent belongs to. E.g. the root node should be in "level000" field, the next level down should be in the "level001" field, and so on. This would allow me to easily filter data based on any hierarchy node in Power BI.
However it appears that get_member_properties returns the parent nodes in the wrong "levelNNN" fields. In the screenshot below, you can see that for each leaf node (account), it returns its parent in "level016", its parent's parent in "level015", and so on. But since the hierarchy is ragged, we end up with the root node (ARP_Statement of Financial Position) in various "levelNNN" fields (depending on how deep in the hierarchy the leaf node lives), instead of only in "level000".
The problem with this, is that for any given hierarchy node, it can appear in multiple "levelNNN" fields, instead of just appearing in the one level. And this makes it very difficult to filter data on any given hierarchy node.
Version
Question
Is it possible to have get_member_properties populate the levelNNN fields in ascending order starting with the root node (ARP – Statement of Financial Position) in level000, followed by level001, and so on, until the leaf node is reached?
The text was updated successfully, but these errors were encountered: