Reza Rad shows how to pivot and unpivot using Power BI:
So Pivot is easy and simple to do, but you have to be careful about the nature and quality of source data set. If it is normal to have a name repeated in the source data, then an aggregation needs to be set properly. if you expect each name to appear once, then setting it as Do Not Aggregate works better because you can use error handling mechanism in Power Query to handle error somehow.
This is a good sight easier than writing a bunch of SUM(CASE) statements or using the PIVOT operator in T-SQL.