Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more
I have a chart with employees and reporting relationships and am trying to do some analysis by the VP of each department. My data looks like this:
Department Employee First Manager Second Manager Third Manager Fourth Manager
Dept 1 Employee 1 Employee 2 Employee 3 VP1 President
Dept 1 Employee 2 Employee 3 VP 1 President
Dept 1 VP 1 President
Dept 2 Employee 4 Employee 5 Employee 6 VP 2 President
Dept 2 Employee 5 Employee 6 VP 2 President
Dept 2 Employee 6 VP 2 President
Dept 2 VP 2 President
I want to end up with this:
Dept VP
Dept 1 VP1
Dept 2 VP2
Please help and thanks!
Solved! Go to Solution.
Could try a big nested if, something like:
if([fourth manager]=null,(similar logic checking the third manager),third manager)
It'll look at each column in turn, and when it finds one that isn't blank, returns the previous column
Hi @AGuero
In the query editor, could you filter the First Manager column=President? That should give you the VP of that department as the only employee in the department. To get to your desired result just delete the other columns an Rename the employee column to VP.
MarkS,
That would work in my simple example, but in reality there are cases where an employee is in a different department than his/her VP.
Hi @AGuero
How about a DAX Measure
Dept_VP = LASTNONBLANK ( VALUES ( TableName[Employee] ), TableName[Employee] )
Thanks Everyone!
I wrote a long, nexted IF statement that worked
IF(Table[Fourth Level Manager]<>"" && Table[Fourth Level Manager] <> "President", Table[Fourth Level Manager], IF(Table[Third Level Manager]<>""&&Table[Third Level Manager]<>"President",Table[Third Level Manager],IF......
In Power Query, just select the rows where First Manager <> null and Second Manager = null
let Source = Table1, #"Filtered Rows" = Table.SelectRows(Source, each [First Manager] <> null and [Second Manager] = null), #"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows",{"Department", "Employee"}), #"Renamed Columns" = Table.RenameColumns(#"Removed Other Columns",{{"Employee", "VP"}}) in #"Renamed Columns"
Hi @AGuero,
You need to use Unpivot and then use Group by functions:
Unpivot and Group By Functions in Power BI Desktop
Hope this helps.
Regards
Abduvali
Could try a big nested if, something like:
if([fourth manager]=null,(similar logic checking the third manager),third manager)
It'll look at each column in turn, and when it finds one that isn't blank, returns the previous column
Check out the April 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
104 | |
68 | |
47 | |
42 | |
39 |