Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
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
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 51 | |
| 37 | |
| 35 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 72 | |
| 70 | |
| 39 | |
| 34 | |
| 23 |