cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
fiekaadib Frequent Visitor
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.

Picture1.png

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.

Picture2.png

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
Super User

Re: Percentage of table across in Power Query

Hi @fiekaadib ,

 

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



Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!




5 REPLIES 5
Super User
Super User

Re: Percentage of table across in Power Query

Hi @fiekaadib ,

 

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



Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!




fiekaadib Frequent Visitor
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
Super User

Re: Percentage of table across in Power Query

Hi @fiekaadib ,

 

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

 

Can you add any additional information in order to help you better.

 

Regards,

MFelix



Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!




Super User
Super User

Re: Percentage of table across in Power Query

Hi @fiekaadib,

 

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

 

Regards,

MFelix



Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!




fiekaadib Frequent Visitor
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!