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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
lw24
Helper I
Helper I

Upload an excel table in order to keep specific grouping

Hello All!

 

I've included an excel file but I'm looking for a solution that would allow me to recreate the following table as shown because my stakholders can be very picky...

 

I'm open to any suggestions! 

SectorName Goal  Prorated Goal  Revenue Revenue against Prorated Goal
Asset Wealth ManagementJoe Smith $      100,000 $                50,000 $        40,00080%
Asset Wealth ManagementMichael Young $      200,000 $              100,000 $        10,00010%
AWM Total  $      300,000 $              150,000 $        50,00033%
BankingBruce Wayne $      100,000 $                50,000 $        40,00080%
BankingMr. Freeze $      200,000 $              100,000 $        10,00010%
Banking Total  $      300,000 $              150,000 $        50,00033%
Grand Total  $      600,000 $              300,000 $      100,00033%
1 ACCEPTED SOLUTION

@lw24 

 

How about this?  Go into Power Query (in a blank pbix) and create a blank query.  In Advanced Editor, replace the existing code with:

 

 

let
  Source = Table.FromRows(
    Json.Document(
      Binary.Decompress(
        Binary.FromText(
          "i45WciwuTi1RCE9NzCnJUPBNzEtMT81NzStR0lHyyk9VCM7NLMkAshVUFMDA0MBAx8DAAEkEAUwxpUxgQhYGqkqxOvhs881MzkhMzVGIzC/NS0cyxAinjdjcYggTMoRZGO6rEJJfkpgDUoak1Bi3sVj8ARcyNoYY65SYl50JdqdTUWlyqkJ4YmVeKhXDCWG+b5GegltRampVKvUCBWo6LQLGvSgxLwWrwWY4Dca0EuELsLmxAA==",
          BinaryEncoding.Base64
        ),
        Compression.Deflate
      )
    ),
    let
      _t = ((type nullable text) meta [Serialized.Text = true])
    in
      type table [
        Sector = _t,
        Name = _t,
        #" Goal " = _t,
        #" Prorated Goal " = _t,
        #" Revenue " = _t,
        #"Revenue against Prorated Goal" = _t
      ]
  ),
  #"Changed Type" = Table.TransformColumnTypes(
    Source,
    {
      {"Sector", type text},
      {"Name", type text},
      {" Goal ", Currency.Type},
      {" Prorated Goal ", Currency.Type},
      {" Revenue ", Currency.Type},
      {"Revenue against Prorated Goal", Percentage.Type}
    }
  ),
  #"Removed Columns" = Table.RemoveColumns(#"Changed Type", {"Revenue against Prorated Goal"}),
  #"Replaced Value" = Table.ReplaceValue(
    #"Removed Columns",
    " ",
    "",
    Replacer.ReplaceValue,
    {"Name"}
  ),
  #"Filtered Rows" = Table.SelectRows(#"Replaced Value", each ([Name] <> "")),
  #"Renamed Columns" = Table.RenameColumns(
    #"Filtered Rows",
    {{" Goal ", "Goal"}, {" Prorated Goal ", "Prorated Goal"}, {" Revenue ", "Revenue"}}
  )
in
  #"Renamed Columns"

 

 

 

Exit Power Query.

 

Next, create these 4 measures:

 

 

Goal = SUM( 'FactTable'[Goal] )

Prorated Goal = SUM( 'FactTable'[Prorated Goal] )

Revenue = SUM( 'FactTable'[Revenue] )

Revenue against Prorated Goal = DIVIDE( [Revenue], [Prorated Goal] )

 

 

 

Next, create a matrix visual and populate it as follows:

Rows: 'FactTable'[Sector], 'FactTable'[Name]

Values:  the 4 measures you just wrote

 

Then its just a matter of setting "+/- icons" to Off and "Stepped Layout" to Off (depending on your preference).  Those settings can be found on the Format pane, under Row Headers (and Row Headers --> Options).

 

ex 1.png

View solution in original post

12 REPLIES 12
gmsamborn
Super User
Super User

Hi @lw24 

 

Using Power Query, I would filter out all Total records.  Otherwise, you'll have those records added to any totals.

 

You won't need them anyways since Power BI is quite capable of calculating any required totals.

 

(Also, [Revenue against Prorated Goal] can easily be calculated.)

 

I hope this helps.

Thanks for quick reply! To clarify, what I'm looking for is for that information to look like that but in a table visual... Each sector has a total with a grand total of the sector totals at the bottom. 

Hi @lw24 

 

Here is an example of a matrix that should cover your requirement.

 

I didn't use an Excel file, I just copied from your above data.  The procedure to follow is the same.

 

I filtered all rows where [Name] is blank.  I made the assumption that those are Total rows.  Other criteria could just as easily be used.  I also removed [Revenue against Prorated Goal] from the source.

 

After 4 simple measures and moving the sub-totals to below the detail instead of above, your matrix is complete.

 

Matrix Grouping.pbix

 

Let me know if you have any questions.

I'm on a work computer and using work credentials. Not sure I'm able to download this... everytime I click the link it takes me to a One Drive page with an error... 

There's no file in One Drive when I click on the link. 

 

I get a message that says ...

 

lw24_0-1705086000234.png

 

I am able to access and initiate the download. However, I'm not able to open because I don't have the latest version of Power BI (which i'm suppose to download from a specific location). My version 2.118.828.0

 

lw24_0-1705087601354.png

 

Hi @lw24 

 

You can get the latest version here.

https://www.microsoft.com/en-us/download/details.aspx?id=58494

 

Also, can you include @gmsamborn  in your reply or I might not see it for a while.

@gmsamborn are screenshots possible? 

@lw24 

 

How about this?  Go into Power Query (in a blank pbix) and create a blank query.  In Advanced Editor, replace the existing code with:

 

 

let
  Source = Table.FromRows(
    Json.Document(
      Binary.Decompress(
        Binary.FromText(
          "i45WciwuTi1RCE9NzCnJUPBNzEtMT81NzStR0lHyyk9VCM7NLMkAshVUFMDA0MBAx8DAAEkEAUwxpUxgQhYGqkqxOvhs881MzkhMzVGIzC/NS0cyxAinjdjcYggTMoRZGO6rEJJfkpgDUoak1Bi3sVj8ARcyNoYY65SYl50JdqdTUWlyqkJ4YmVeKhXDCWG+b5GegltRampVKvUCBWo6LQLGvSgxLwWrwWY4Dca0EuELsLmxAA==",
          BinaryEncoding.Base64
        ),
        Compression.Deflate
      )
    ),
    let
      _t = ((type nullable text) meta [Serialized.Text = true])
    in
      type table [
        Sector = _t,
        Name = _t,
        #" Goal " = _t,
        #" Prorated Goal " = _t,
        #" Revenue " = _t,
        #"Revenue against Prorated Goal" = _t
      ]
  ),
  #"Changed Type" = Table.TransformColumnTypes(
    Source,
    {
      {"Sector", type text},
      {"Name", type text},
      {" Goal ", Currency.Type},
      {" Prorated Goal ", Currency.Type},
      {" Revenue ", Currency.Type},
      {"Revenue against Prorated Goal", Percentage.Type}
    }
  ),
  #"Removed Columns" = Table.RemoveColumns(#"Changed Type", {"Revenue against Prorated Goal"}),
  #"Replaced Value" = Table.ReplaceValue(
    #"Removed Columns",
    " ",
    "",
    Replacer.ReplaceValue,
    {"Name"}
  ),
  #"Filtered Rows" = Table.SelectRows(#"Replaced Value", each ([Name] <> "")),
  #"Renamed Columns" = Table.RenameColumns(
    #"Filtered Rows",
    {{" Goal ", "Goal"}, {" Prorated Goal ", "Prorated Goal"}, {" Revenue ", "Revenue"}}
  )
in
  #"Renamed Columns"

 

 

 

Exit Power Query.

 

Next, create these 4 measures:

 

 

Goal = SUM( 'FactTable'[Goal] )

Prorated Goal = SUM( 'FactTable'[Prorated Goal] )

Revenue = SUM( 'FactTable'[Revenue] )

Revenue against Prorated Goal = DIVIDE( [Revenue], [Prorated Goal] )

 

 

 

Next, create a matrix visual and populate it as follows:

Rows: 'FactTable'[Sector], 'FactTable'[Name]

Values:  the 4 measures you just wrote

 

Then its just a matter of setting "+/- icons" to Off and "Stepped Layout" to Off (depending on your preference).  Those settings can be found on the Format pane, under Row Headers (and Row Headers --> Options).

 

ex 1.png

I'm not suppose to download applications from outside my company's specific environment. 

@lw24 

 

I guess your hands are tied.  I would try to explain that it is software required for you to do your job.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.