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
unichan_jk
Regular Visitor

How to Compute data in Percentage if there's a value in a column

Hello,

 

I have data in an excel file wherein the Overall Percentage should be 100%.

I want to compute that if for example, the Column F is NO, then the Overall Percentage should be multiplied by 0.5, but if YES then just 0.

Also, if there is a value in Column G(Name), then another multiply the Overall Percentage by 0.15. 

For every input in Column H-I, if it has any value, then it should be multiplied by 0.075 from the Overall Percentage also.

 

How to put the formula in Powerbi? I need to put it in a bar graph in PowerBI 

 

This is the formula if it's in excel

 

=(1-((IF(F2="NO",0.5,0))+(COUNTA(G2)*0.15)+(COUNTA(H2,I2)*0.075)*0.05)))/1

 

unichan_jk_0-1654579438906.png

 

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @unichan_jk ;

You could try to create a custom column.

=1-(if [found]="NO" then 0.5  else 0)-(List.NonNullCount({[Name]})*0.15)-(List.NonNullCount({[age],[Address]})*0.075*0.05)

vyalanwumsft_0-1654760116433.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WqijNLVDSUTI0MjQ2NDIGsopSS4AIyDDVN9U3MjAyAjLLU1OzFQyBjMjUYiAJVg8k8kpzciBcMyM9UwNVpVidaKWSjEywiabGJsamIANLUmHmGeE2D8U0c5BRsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Code = _t, Number = _t, ID = _t, #"date processed" = _t, #"audit week" = _t, found = _t, Name = _t, age = _t, Address = _t, Info = _t, #"overall " = _t]),
    #"Replaced Value" = Table.ReplaceValue(Source,"",null,Replacer.ReplaceValue,{"Name", "age", "Address", "Info"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Replaced Value",{{"Code", type text}, {"Number", Int64.Type}, {"ID", type text}, {"date processed", type date}, {"audit week", type text}, {"found", type text}, {"Name", type text}, {"age", Int64.Type}, {"Address", Int64.Type}, {"Info", type text}, {"overall ", Percentage.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each 1-(if [found]="NO" then 0.5  else 0)-(List.NonNullCount({[Name]})*0.15)-(List.NonNullCount({[age],[Address]})*0.075*0.05))
in
    #"Added Custom"

The final output is shown below:

vyalanwumsft_1-1654760200778.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-yalanwu-msft
Community Support
Community Support

Hi, @unichan_jk ;

You could try to create a custom column.

=1-(if [found]="NO" then 0.5  else 0)-(List.NonNullCount({[Name]})*0.15)-(List.NonNullCount({[age],[Address]})*0.075*0.05)

vyalanwumsft_0-1654760116433.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WqijNLVDSUTI0MjQ2NDIGsopSS4AIyDDVN9U3MjAyAjLLU1OzFQyBjMjUYiAJVg8k8kpzciBcMyM9UwNVpVidaKWSjEywiabGJsamIANLUmHmGeE2D8U0c5BRsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Code = _t, Number = _t, ID = _t, #"date processed" = _t, #"audit week" = _t, found = _t, Name = _t, age = _t, Address = _t, Info = _t, #"overall " = _t]),
    #"Replaced Value" = Table.ReplaceValue(Source,"",null,Replacer.ReplaceValue,{"Name", "age", "Address", "Info"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Replaced Value",{{"Code", type text}, {"Number", Int64.Type}, {"ID", type text}, {"date processed", type date}, {"audit week", type text}, {"found", type text}, {"Name", type text}, {"age", Int64.Type}, {"Address", Int64.Type}, {"Info", type text}, {"overall ", Percentage.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each 1-(if [found]="NO" then 0.5  else 0)-(List.NonNullCount({[Name]})*0.15)-(List.NonNullCount({[age],[Address]})*0.075*0.05))
in
    #"Added Custom"

The final output is shown below:

vyalanwumsft_1-1654760200778.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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