Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jhartranft60
Advocate IV
Advocate IV

PATH function error

 

I'm attempting to build a quarterly hierarchy.  I'm creating this to track our yearly performance appraisal requirements, so the hierarchy is used for both row-level security as well as rolling up colleague performance measures to the appropriate leaders.  Since colleagues can change teams over the course of the year, the staffing is tracked quarterly.  Due to this, I created a "Unique ID" for each colleague (Concat Employee ID, "-" & Quarter).  I've verified that there are no duplicates in the Unique ID field.  Below is the formula I'm using and the error I'm getting.  It seems DAX doesn't like that there are multiple values in the 'Manager ID' field over the course of the year.  I'd hoped that using the CALCULATE function would fix my problems, but obviously I was mistaken.  I've run out of ideas on how to make this work.  Thoughts and suggestions are highly appreciated!!

 

"Each value in 'Staff by Quarter'[Employee ID] must have the same value in 'Staff by Quarter'[Manager ID].  The value '4567' has multiple values."

 

Hierarchy = CALCULATE(PATH('Staff by Quarter'[Employee ID],'Staff by Quarter'[Manager ID]),FILTER('Staff by Quarter','Staff by Quarter'[Quarter]=EARLIER('Staff by Quarter'[Quarter])))

 

Employee IDQuarterUnique-IDManager ID
1234Q11234-Q19999
1234Q21234-Q29999
1234Q31234-Q39999
1234Q41234-Q49999
4567Q14567-Q17777
4567Q24567-Q28888
4567Q34567-Q38888
4567Q44567-Q48888
1 ACCEPTED SOLUTION
mahoneypat
Employee
Employee

FYI that you likely need to address the distinct parent issue, but you can use the Bonus Function at the end of this article to perform the equivalent of the PATH function in your query (and it doesn't have the single parent limitation).

Guest Post: Using List.Accumulate for Input/Output Genealogy – The BIccountant

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

4 REPLIES 4
mahoneypat
Employee
Employee

FYI that you likely need to address the distinct parent issue, but you can use the Bonus Function at the end of this article to perform the equivalent of the PATH function in your query (and it doesn't have the single parent limitation).

Guest Post: Using List.Accumulate for Input/Output Genealogy – The BIccountant

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


selimovd
Super User
Super User

Hello @jhartranft60 ,

 

if you use the PATH function each item must have a distinct parent. So the problem is that employee 4567 has managger 8888 and manager 7777. 

Also be aware that PATH doesn't work with row level security:
"This function is not supported for use in DirectQuery mode when used in calculated columns or row-level security (RLS) rules."

 

Sorry for that, but I think this approach doesn't work.

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

Hi @selimovd 

 

I use the hierarchy column created by the path function for the RLS.  I use the PATHCONTAINS function to search the hierarchy column for the userprincipalname.  I use this on many of my datasets, so I know it works well.  

 

I guess I don't understand why my calculate function doesn't work to filter out the multiple managers.  The second half of the function "Filter('Staff by Quarter','Staff by Quarter'[Quarter] = EARLIER('Staff by Quarter'[Quarter])" should filter the table down to just one Quarter and therefore eliminate the fact that there are different Manager IDs for different quarters.  That's the part I'm attempting to figure out how to tweak to make this thing work.

 

 

Hey @jhartranft60 ,

 

you get the error in the first half of the measure:

CALCULATE(PATH('Staff by Quarter'[Employee ID],'Staff by Quarter'[Manager ID])

 

Here the employee 4567 has manager 8888 and manager 7777. This ambiguity is not allowed, so there will be an error.

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.