hierarchy
33 TopicsCreate Company/Project Hierarchy and show Projects at their respective level
Hello, I have 2 tables: Company table, where a Parent Company ID filed is pointing to a record in the same table. Project table where each Project is executed by a Company. I want to create a filter where I put the Companies and it shows by Hierarchy level, then under each Company there will be the Projects associated to it and the Companies under it if there's any. I tried iteration of PATH(), PATHLENGTH(), and PATHITEM() and got close results. Result needed in the filter: - Company X - Company A - Company D - Project Z - Company B - Project V - Project U - Company C - Company E - Project P Attaching some sample data. Companies CompanyID,CompanyName,ParentCompanyID 1,Global Holdings, 2,North America Division,1 3,Europe Division,1 4,Asia Division,1 5,US Subsidiary A,2 6,US Subsidiary B,2 7,Canada Subsidiary,2 8,EU Subsidiary A,3 9,EU Subsidiary B,3 10,Germany Ops,8 11,France Ops,8 12,Asia Subsidiary A,4 13,Asia Subsidiary B,4 14,Japan Ops,12 15,Korea Ops,12 16,Australia Region,4 17,Sydney Office,16 18,Melbourne Office,16 19,UK Ops,9 20,London Office,19 Projects ProjectID,ProjectName,CompanyID,ProjectStatus,StartDate,EndDate 1,Project Alpha,2,Active,2023-01-01,2023-06-30 2,Project Beta,2,Completed,2022-05-01,2022-10-31 3,Project Gamma,3,Active,2023-03-01,2023-09-30 4,Project Delta,3,On Hold,2023-02-01,2023-07-31 5,Project Epsilon,5,Completed,2021-07-15,2021-12-31 6,Project Zeta,6,Active,2023-01-15,2023-07-15 7,Project Eta,7,On Hold,2022-10-01,2023-04-30 8,Project Theta,8,Active,2023-04-01,2023-09-01 9,Project Iota,9,Completed,2022-01-01,2022-06-30 10,Project Kappa,10,Active,2023-02-01,2023-08-31 11,Project Lambda,11,On Hold,2022-08-01,2023-02-28 12,Project Mu,12,Active,2023-03-01,2023-08-31 13,Project Nu,13,Completed,2021-12-01,2022-05-31 14,Project Xi,14,On Hold,2023-06-01,2023-12-31 15,Project Omicron,15,Active,2023-04-01,2023-09-30 16,Project Pi,16,Completed,2022-02-01,2022-07-31 17,Project Rho,17,Active,2023-01-01,2023-06-30 18,Project Sigma,18,Completed,2022-09-01,2023-03-31 19,Project Tau,19,Active,2023-02-01,2023-07-31 20,Project Upsilon,20,On Hold,2023-01-15,2023-06-15 21,Project A1,5,Active,2023-03-01,2023-08-01 22,Project B1,6,Completed,2022-05-15,2022-11-30 23,Project C1,8,On Hold,2023-07-01,2023-12-01 24,Project D1,9,Active,2023-01-10,2023-07-10 25,Project E1,12,Completed,2021-10-01,2022-04-30 26,Project F1,13,Active,2023-04-10,2023-10-01 27,Project G1,14,Completed,2022-12-15,2023-05-30 28,Project H1,15,Active,2023-05-01,2023-11-01 29,Project I1,16,On Hold,2022-06-01,2022-12-15 30,Project J1,17,Completed,2022-03-01,2022-08-15 31,Project K1,19,Active,2023-04-01,2023-09-15 32,Project L1,20,On Hold,2023-05-15,2023-10-01 33,Project M1,5,On Hold,2023-01-01,2023-06-30 34,Project N1,6,Active,2023-04-01,2023-09-01 35,Project O1,9,Completed,2021-07-01,2022-01-31 36,Project P1,12,Active,2023-02-01,2023-08-31 37,Project Q1,13,On Hold,2022-11-01,2023-04-01 38,Project R1,14,Active,2023-01-01,2023-06-30 39,Project S1,16,Completed,2022-08-01,2023-01-15 40,Project T1,18,Active,2023-03-01,2023-08-31 41,Project U1,8,Completed,2022-04-01,2022-09-30 42,Project V1,10,Active,2023-05-01,2023-10-01 43,Project W1,11,On Hold,2023-02-01,2023-07-31 44,Project X1,19,Completed,2022-09-01,2023-03-31 45,Project Y1,17,Active,2023-01-10,2023-06-30 46,Project Z2,3,On Hold,2023-07-01,2023-12-01 47,Project Z3,2,Completed,2022-08-15,2023-01-15 48,Project Z4,6,Active,2023-02-01,2023-07-30 49,Project Z5,7,Completed,2022-10-15,2023-04-01 50,Project Z6,8,Active,2023-01-15,2023-06-15 Thanks in advance for the support.Solved1.8KViews3likes7CommentsBudget sum in a parent-child hierarchy matrix
Hello everyone, I am writing to you because I have a problem that I cannot solve. I have a table that contains a list of hierarchically linked projects (parent-child). The depth of the hierarchy is variable. Each project has a budget. The sum of the budgets of a project's direct children can be less than or equal to its budget. If possible, I would like to display the following in a matrix that allows me to browse the hierarchy (+/-) : - the budget for each project - the sum of its direct children (level n+1) - the sum of the leaves in the hierarchy Example of input table: Name of project ID Father id Budget A 1 100 000 B 2 1 50 000 C 3 1 40 000 D 4 2 20 000 E 5 2 30 000 F 6 3 30 000 Example of the expected result: Level 1 Level 2 (if displayed by user) Level 3 (if displayed by user) Project budget Sum of direct child project budgets Sum of the leaves A 100 000 90 000 80 000 B 50 000 50 000 50 000 D 20 000 0 0 E 30 000 0 0 C 40 000 30 000 30 000 F 30 000 0 0 I have tried a number of things, including following this video step by step https://www.youtube.com/watch?v=iwRqSl-_zvU, but I cannot achieve the expected result. Last but not least : I have PowerBI Destktop 2019 😉 Thank you very much for taking the time to read this and for responding if you have any ideas. ThomasSolved1.1KViews0likes6CommentsParent-Child Filtering In a Many-to-Many Model
I'm working on a dashboard reporting Absences organization wide. Below is a baseline data model based on our timekeeping software's data tier. In essence, we have a hierarchical org chart (OrgPath), with Employees mapped to one node at any time. Some employees are managers and are assigned AccessGroup containers which are mapped to 1+ OrgPaths. The intention of the dashboard is for RLS to filter the dashboard based on USERNAME() or another function to only display personnel in OrgPaths that are directly part of the manager's access group, AND for any child OrgPaths for those explicit parent OrgPaths. Building the PATH for the OrgPath is straightforward in DAX, but in RLS, I've tried using SELECTEDVALUE in this fashion but no luck OrgPaths[OrgPathID] IN PATH(SELECTEDVALUE(AccessGroupsOrgPathsMM(OrgPathID), OrgPaths[ParentOrgPathID]) What should be the DAX expression to filter the Absences table on Employees belonging to the 1+ OrgPaths part of the manager's selected AccessGroup? ERD below T-SQL DDL for the model is here. CREATE SCHEMA AbsenceDashboard GO CREATE TABLE AbsenceDashboard.OrgPaths ( OrgPathID int IDENTITY(1,1) NOT NULL PRIMARY KEY, OrgPath varchar(50), ParentOrgPathId int ) CREATE TABLE AbsenceDashboard.Employees ( EmployeeID int IDENTITY(1,1) NOT NULL PRIMARY KEY, EmployeeName varchar(50), OrgPathID int NOT NULL, ManagerID int ) GO ALTER TABLE AbsenceDashboard.Employees ADD CONSTRAINT FK_1 FOREIGN KEY(OrgPathID) REFERENCES AbsenceDashboard.OrgPaths(OrgPathID) GO CREATE TABLE AbsenceDashboard.AccessGroups ( AccessGroupID int IDENTITY(1,1) NOT NULL PRIMARY KEY, AccessGroup varchar(50) ) CREATE TABLE AbsenceDashboard.EmployeeAccessGroupsMM ( EmployeeID int NOT NULL, AccessGroupID int NOT NULL ) ALTER TABLE AbsenceDashboard.EmployeeAccessGroupsMM ADD CONSTRAINT FK_2 FOREIGN KEY(EmployeeID) REFERENCES AbsenceDashboard.Employees(EmployeeID) GO ALTER TABLE AbsenceDashboard.EmployeeAccessGroupsMM ADD CONSTRAINT FK_3 FOREIGN KEY(AccessGroupID) REFERENCES AbsenceDashboard.AccessGroups(AccessGroupID) GO CREATE TABLE AbsenceDashboard.AccessGroupsOrgPathsMM ( AccessGroupID int NOT NULL, OrgPathID int NOT NULL ) GO ALTER TABLE AbsenceDashboard.AccessGroupsOrgPathsMM ADD CONSTRAINT FK_4 FOREIGN KEY(OrgPathID) REFERENCES AbsenceDashboard.AbsenceDashboard(OrgPathID) GO ALTER TABLE AbsenceDashboard.AccessGroupsOrgPathsMM ADD CONSTRAINT FK_5 FOREIGN KEY(AccessGroupID) REFERENCES AbsenceDashboard.AccessGroups(AccessGroupID) GO CREATE TABLE AbsenceDashboard.Absences ( AbsenceID int NOT NULL PRIMARY KEY, EmployeeID int, DateAbsent date, DateReported datetime DEFAULT GETDATE() ) ALTER TABLE AbsenceDashboard.Absences ADD CONSTRAINT FK_6 FOREIGN KEY(EmployeeID) REFERENCES AbsenceDashboard.Employees(EmployeeID) GO741Views0likes4CommentsCalculated measure as hierarchy
Hi, I have issue trying to have matrix to show calculated measure as row header/hierarchy. Any helps will be appreciated. Here is my test data and also separate standard calendar table that I dont add here Client Country Policy Inception Date Cancelation Date Claim No Claim Date ABC US P1 15/01/2024 C01 3/02/2024 ABC UK P2 17/01/2024 2/02/2024 ABC UK P3 20/02/2024 C03 5/05/2024 ABC UK P4 31/03/2024 C04 ABC UK P5 31/03/2024 C05 ABC US P6 10/03/2024 C06 ABC US P7 1/05/2024 C07 20/06/2024 ABC UK P8 2/05/2024 C08 ABC US P9 3/05/2024 C09 and here is my expected result Jan Feb Mar Apr May June Active Policy count 2 2 5 0 8 0 ABC 2 2 5 0 8 0 US 1 1 2 0 4 0 UK 1 1 3 0 4 0 Claims Count 0 1 0 0 1 1 ABC 0 1 0 0 1 1 US 0 1 0 0 0 1 UK 0 0 0 0 1 0 Thank you!Solved1.1KViews0likes2CommentsDate hierarchy
Hi, I have a general question about Dax in Excel. I have a fact table and in Power Queryand from this fact table I make a date table. I do this because I want to use the date table as a slicer. Then I push both table from Power Query to the Data model so that I can work with DAX. When I make a pivot table in Excel I am not seeing the date hierarchy (Year, Month, Day) that I would expect from the date table. However, this hierarchy is being created when I use the date column in my fact table. My question is, why is the hierarchy not being created when using the date table? Thanks, Naveen794Views0likes1CommentParent Child Hierarchy - Sum all Leafs on each NodeLevel
Hello everyone I hope you can help me with my Parent Child Hierarchy problem. I want to use a Dax measure to make the amount from the fact table (on hierarchy leaves) available on all node levels. The specialty is that I want to use the flat hierarchy column “Name” from the table “Hierarchy” in the visual. Without the following solutions: Using a hierarchy Lev1-3 or LevName1-3 in scope of the visual Calculation as a column and not as a separate dax measure In the attached picture you can see the test data and the desired result.Solved1.1KViews0likes3CommentsApplying different weights on each level of hierarchy
Hello, I have PnL fact table like this: fact_table([id],[date],[account_key],[sales_amount]) and dimension for PnL hierarchy like this: dimension_table([account_key],[level_1_name],[level_2_name],[level_2_weight],[level_3_name],[level_3_weight],[level_4_name],[level_4_weight],[level_5_name],[level_5_weight]) relationship between those table is M:N through account_key. I need to calculate sum of sales_amount with applying the correct weight when going from a lower level of the hierarchy to a higher one. Not all levels for each account is valid -> each level except one can be null. I tried everything with INSCOPE, RELATED, SWITCH and SUMX but nothing worked for me. Link to the file here: PBIX I would very much appreciate any help. Thank you very much in advance.1.3KViews0likes7CommentsReconcilation of values between parent and child -Calculated column
Hi, Request your support on formulating the correct DAX formula for caclulated column which calculates the value of sum of the children of that Node. There are more than five levels of parent ,child relation ship.Reconciliation need to happen for all parents with their immediate next level children. The generated table is as below My dax formula for the calculated column "Units_Expected" is not giving values correctly as its aggregating totally. In this sample only three levels are shown but acutal data has more levels. I request a generic formula for any number of levels. Units_Expected = if( Units_Reconciliation_Table[Node Type]="level1", sumx( FILTER(Units_Reconciliation_Table,PATHITEM(Units_Reconciliation_Table[Entity Path],2,INTEGER) =Units_Reconciliation_Table[Child Node ID]), Units_Reconciliation_Table[Units_Actuals]), ( if(Units_Reconciliation_Table[Node Type]="level2", sumx( FILTER(Units_Reconciliation_Table, AND( PATHITEM(Units_Reconciliation_Table[Entity Path],3,INTEGER) =Units_Reconciliation_Table[Child Node ID], PATHITEM(Units_Reconciliation_Table[Entity Path],2,INTEGER) =Units_Reconciliation_Table[Immediate_Parent])), Units_Reconciliation_Table[Units_Actuals]), if(Units_Reconciliation_Table[Node Type]="level3", sumx( FILTER(Units_Reconciliation_Table,PATHITEM(Units_Reconciliation_Table[Entity Path],4,INTEGER) =Units_Reconciliation_Table[Child Node ID]), Units_Reconciliation_Table[Units_Actuals]), if(Units_Reconciliation_Table[Node Type]="level4", sumx( FILTER(Units_Reconciliation_Table,PATHITEM(Units_Reconciliation_Table[Entity Path],5,INTEGER) =Units_Reconciliation_Table[Child Node ID]), Units_Reconciliation_Table[Units_Actuals]) ) ) ))) Appreciate your help . Thanks in advance.Solved579Views0likes2CommentsDAX percentage over hierarchy - my column totals are not respecting the column filter context
I have a matrix with a row hierarchy - the parent field is Team Leader and the child is Agent. The values are [Number of Coachings] and the columns are [YearMonth]. All my data is in a single table so there are no data model relationships. I have created a measure to capture the percentage of coachings over hierarchy - when it is an agent row I want the percentage of the total coachings of that agent, when it is a team leader I want the percentage of all the team leaders, but only for that YearMonth column. My formula is calculating the percentage of all columns and I cannot figure out how to modify it to make it functional. The measure formula - (Variable X contains all my report slicers) % Parent By Agent = VAR x = ALLEXCEPT(Query1, Query1[Team Leader],Query1[JobStatus], Query1[DepartmentGroup], Query1[DaysSinceHire], Query1[NewAgent_Current], Query1[YearMonth]) VAR Scope_Agent = CALCULATE(COUNT(Query1[Feedback_Title]),x,Query1[Team Leader] = VALUES(Query1[Team Leader])) VAR Scope_TL = CALCULATE(COUNT(Query1[Feedback_Title]),ALLSELECTED(Query1)) RETURN SWITCH( TRUE() // Agent rows ISINSCOPE(Query1[Agent]), DIVIDE(COUNT(Query1[Feedback_Title]), Scope_Agent), //Team Leader rows ISINSCOPE(Query1[Team Leader]), DIVIDE(COUNT(Query1[Feedback_Title]), Scope_TL), //Grand Total row , DIVIDE(COUNT(Query1[Feedback_Title]), Scope_TL)) It works when I filter on 1 YearMonth column, but if I select more than 1 YearMonth values, the percentage is calculated over all columns. How can I modify so that the formula calculates on the column filter context for all hierarchy levels? I want each level of the hierarchy for each YearMonth column to add up to 100%. Currently the child percentage adds up to 100% per column but the parent percentage is calculating on the time period in the slicer, not on the matrix column.Solved1.6KViews0likes3CommentsRepeating values in PowerBI Hierarchy
Hello there, I am trying to create a hierarchy in PowerBI. There can be upto 7 levels in the hierarchy. So, I've defined Path and the 7 levels. However, there are items with less than 7 levels (some even 1). The Matrix table shows the same values of the parent till level 7. Is there a way to control this recursion? Attaching screenshots below. Thanks! Path DAX: Path length < 7 Level definition: Matrix Visual:882Views0likes0Comments