Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Matrix using multiple columns w/ same pick list values

Hi all,

 

Been searching for some time and haven't found a good solution to an issue we're having in terms of building out a matrix that takes multiple columns that all have the same pick list values and summarizes them based on those that we could then slice based on other dimensions within the same table.

 

I have a single table at the moment w/ all of our data.  Simplified, the data looks like the following:

Deal#BudgetTechPlanFitValue
1YesNoYesYes10
2NoYesMaybeMaybe15
3YesNoNoYes10
4YesNoYesYes15
5YesMaybeYesNo20
6NoYesYesNo5
7NoMaybeMaybeMaybe10
8MaybeYesNoNo5
9YesYesYesYes10

 

What we'd then like to build out is a matrix like the following:

Sum of Value

 YesNoMaybe
Budget65305
Tech353530
Plan601525
Fit453025

 

Is this possible?  Much appreciated, thanks!

 

8 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    can you share your powerbi file?

  • PaulDBrown's avatar
    PaulDBrown
    Community Champion

    The easiest way is to unpivot the table to get the "Types in rows":

    You can then create three measures (for Yes/No/Maybe) using the following:

     

     

    Yes =
    CALCULATE ( SUM ( Unpivoted[Value] ), Unpivoted[Criteria] = "Yes" )
    

     

     

    Create the matrix by putting "type" in the rows bucket and add the three measures to get:

     

    I've attached the sample PBIX file

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks for the quick response as well as the file.  Quick follow up question; if the backend data refreshes daily, is there a way to automate this?  I created a dummy file but due to restrictions can't share from my onedrive nor can i see a way to upload here.  The actual data is over 100k rows and 50+ columns, but I think the methodology makes sense (this would be the first time using the unpivot function as i'm still new to PBI), but I'm not sure if it's something that would run daily.  Thanks again!

      • PaulDBrown's avatar
        PaulDBrown
        Community Champion

        Sure. The unpivoting takes place as a step in Power Query, so it will create the unpivoted table automatically once it is set up. 
        You can share the dummy file using a cloud service or something like wetransfer