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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Table Formatting

Hi,

 

I have taken this table from Excel & cannot use 'transpose' as this is the layout required - How do I edit this query so that the '%' rows are in percentage format & the Jul-21 list is in this order: 

Revenue, Gross Profit, GP%, Overheads, Operating Profit, OP%, EBITDA, EBITDA %, EBITDA adj, EBITDA adj %?

DTaylor888_0-1630661358798.png

Thanks

2 ACCEPTED SOLUTIONS
bchager6
Super User
Super User

Here's a solution:

  1. Using a table with just the first and second columns, and just the Revenue, GP%, and Gross Profit rows, I created a conditional column named "Sort Column" in the Query Editor, assigning 1 to Revenue, 2 to Gross Profit, and 3 to GP%
    bchager6_2-1630688936760.png
     

    bchager6_0-1630688767686.png
  2. Then I created a custom column to convert any values in the Actual Month column aligned to the GP % row to a percentage: =if[#"7/21/2021"] = "GP %" then Number.ToText([Actual Month], "p") else [Actual Month]
  3. Then I removed the Actual Month column and renamed the Custom column to Actual Month
  4. After applying those steps, I closed the query editor and sorted the 7/21/21 column by the Sort Column

bchager6_3-1630689156936.png


Here's the end result. It works, but all the values are of the text data type. But maybe that doesn't matter here because we wouldn't want to sum decimal numbers with percentages anyway.

bchager6_4-1630689334567.png

I hope this helps. If it does, please mark it as the solution.

View solution in original post

V-pazhen-msft
Community Support
Community Support

@Anonymous 
1. To sort the column, you can add an index then sort using conditional column as @bchager6 suggested. 

 

2. In order to change some value to %, you need to create a measure for each column, just replace the referred column to the corresponding column name. For example:

 
Anual month measure = IF(RIGHT(MAX([Type]),1)="%",FORMAT(MAX([Anual Month]),"Percent"),MAX([Anual Month]))

Anual Year measure = IF(RIGHT(MAX([Type]),1)="%",FORMAT(MAX([Anual Year]),"Percent"),MAX([Anual Year]))

Vpazhenmsft_1-1630996454731.png

 

 

Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

@bchager6 @V-pazhen-msft Thats perfect, thank you very much for your help!

Anonymous
Not applicable

@V-pazhen-msft I don't suppose you know what to add to the measure so that the percentage rows show to the nearest percent (0 d.p.)? Formatting to 0 d.p. in 'Measure tools' only applies to the non-percentage values. Thanks

V-pazhen-msft
Community Support
Community Support

@Anonymous 
1. To sort the column, you can add an index then sort using conditional column as @bchager6 suggested. 

 

2. In order to change some value to %, you need to create a measure for each column, just replace the referred column to the corresponding column name. For example:

 
Anual month measure = IF(RIGHT(MAX([Type]),1)="%",FORMAT(MAX([Anual Month]),"Percent"),MAX([Anual Month]))

Anual Year measure = IF(RIGHT(MAX([Type]),1)="%",FORMAT(MAX([Anual Year]),"Percent"),MAX([Anual Year]))

Vpazhenmsft_1-1630996454731.png

 

 

Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

@V-pazhen-msft  I like this. It preserves the data type and only relies on a % suffix. 👍

bchager6
Super User
Super User

Here's a solution:

  1. Using a table with just the first and second columns, and just the Revenue, GP%, and Gross Profit rows, I created a conditional column named "Sort Column" in the Query Editor, assigning 1 to Revenue, 2 to Gross Profit, and 3 to GP%
    bchager6_2-1630688936760.png
     

    bchager6_0-1630688767686.png
  2. Then I created a custom column to convert any values in the Actual Month column aligned to the GP % row to a percentage: =if[#"7/21/2021"] = "GP %" then Number.ToText([Actual Month], "p") else [Actual Month]
  3. Then I removed the Actual Month column and renamed the Custom column to Actual Month
  4. After applying those steps, I closed the query editor and sorted the 7/21/21 column by the Sort Column

bchager6_3-1630689156936.png


Here's the end result. It works, but all the values are of the text data type. But maybe that doesn't matter here because we wouldn't want to sum decimal numbers with percentages anyway.

bchager6_4-1630689334567.png

I hope this helps. If it does, please mark it as the solution.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors