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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric 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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Solution Authors