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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
sanjay009
Helper III
Helper III

percentage calculated column from multiple column yes and no options

I have a table as below. I am trying to create a column with percentage of yes column as excel formula.=(IF(B2="Yes", 0.25,0)+IF(C2="Yes",0.25,0)+IF(D2="Yes",0.25,0)+IF(E2="Yes",0.25,0))

 

ID  A     B      C      D                  expected column  Score%

1   yes   No   yes   No                                50%                         

2   No   No   yes   No                                 25%

3   No   No   No   No                                  0%

 

Thank you for the help

1 ACCEPTED SOLUTION
Anonymous
Not applicable

 

 

let
    Origine = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjy0QElH6dCCytRiKMsvH7tQrE60khG6GnyKjXEqRmXExgIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"ID " = _t, #"A " = _t, #" B " = _t, #"C " = _t, #"D " = _t]),
    #"Modificato tipo" = Table.TransformColumnTypes(Origine,{{"ID ", Int64.Type}, {"A ", type text}, {" B ", type text}, {"C ", type text}, {"D ", type text}}),
    #"Aggiunta colonna personalizzata" = Table.AddColumn(#"Modificato tipo", "pcYes", each Text.Format("#{0}%",{List.Count(List.FindText(Record.FieldValues(_),"yes"))*25}))
in
    #"Aggiunta colonna personalizzata"

 

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

 

 

let
    Origine = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjy0QElH6dCCytRiKMsvH7tQrE60khG6GnyKjXEqRmXExgIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"ID " = _t, #"A " = _t, #" B " = _t, #"C " = _t, #"D " = _t]),
    #"Modificato tipo" = Table.TransformColumnTypes(Origine,{{"ID ", Int64.Type}, {"A ", type text}, {" B ", type text}, {"C ", type text}, {"D ", type text}}),
    #"Aggiunta colonna personalizzata" = Table.AddColumn(#"Modificato tipo", "pcYes", each Text.Format("#{0}%",{List.Count(List.FindText(Record.FieldValues(_),"yes"))*25}))
in
    #"Aggiunta colonna personalizzata"

 

 

mhossain
Solution Sage
Solution Sage

Hello @sanjay009 

 

You can apply same IF then Else logic in your m query Custom column, what is the issue you are getting? If possible share the dummy pbix.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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