cancel
Showing results for
Did you mean:
Highlighted
Frequent Visitor

## Percentage of table across in Power Query

Hi,

I need to convert visualization in Tableau to Power BI as below;

And my value for the percentage is not showing the correct number.

So what I did in PBI is that I duplicate a table in the Power Query Editor and grouped rows to get the total of each Billed and Unbilled AR and the sum first. Then divide ([sum Billed AR]/[Total Billed AR])*100.

But it didn't give me the correct amount.

I need to make sure that the calculation is able to calculate the percentage across the table instead of the columns' value.

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

## Re: Percentage of table across in Power Query

You need to create the following measures:

```% Billed =
SUM ( Table1[Billed AR (kUSD)] )
/ CALCULATE ( SUM ( Table1[Billed AR (kUSD)] ); ALL ( Table1[Month] ) )

% Unbilled =
SUM ( Table1[Unbilled AR (kUSD)] )
/ CALCULATE ( SUM ( Table1[Unbilled AR (kUSD)] ); ALL ( Table1[Month] ) )

```

I'm assuming that the 1,2,3,... is month, change it by the column name you have in your model.

Regards,

MFelix

Proud to be a Datanaut!

5 REPLIES 5
Super User

## Re: Percentage of table across in Power Query

You need to create the following measures:

```% Billed =
SUM ( Table1[Billed AR (kUSD)] )
/ CALCULATE ( SUM ( Table1[Billed AR (kUSD)] ); ALL ( Table1[Month] ) )

% Unbilled =
SUM ( Table1[Unbilled AR (kUSD)] )
/ CALCULATE ( SUM ( Table1[Unbilled AR (kUSD)] ); ALL ( Table1[Month] ) )

```

I'm assuming that the 1,2,3,... is month, change it by the column name you have in your model.

Regards,

MFelix

Proud to be a Datanaut!

Frequent Visitor

## Re: Percentage of table across in Power Query

Thanks @MFelix ,

this calculation works for DAX, but I'm trying to find any solutions that can be done in power query instead since I need to unpivot the value.

this is the requirement from the users.

Super User

## Re: Percentage of table across in Power Query

One question what do you mean by unpivot the value?

Making the value on query editor will make it harder to re-use the value especcially because it's a % if you want to calculate it for overall values using a column on the query editor will not give you the expected result.

I'm assuming that your information on the query editor is with a table like:

Month - Billed - Unbilled

Regards,

MFelix

Proud to be a Datanaut!

Super User

## Re: Percentage of table across in Power Query

Can you share how you have your table setup in the query editor?

Regards,

MFelix

Proud to be a Datanaut!

Frequent Visitor

## Re: Percentage of table across in Power Query

Hi Felix,

I have a discussion with the product owner and she agreed to change to your solution.

Thanksss!