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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
u4us1923
Frequent Visitor

it's a simple question.

Hello.. 

 

I have a table such as below. I want to subtract the failed call from the total call and put the result in a new row (success_call).

Can anyone who has information about this subject help me?

 

Call TypeCount 
total_call10000 
Failed_call100 
Success_Call9900 new rows
1 ACCEPTED SOLUTION
dufoq3
Super User
Super User

Hi @u4us1923, you can do this easily in Excel but here you go:

 

dufoq3_0-1713367568221.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WKskvScyJT07MyVHSUTI0AAKlWJ1oJbfEzJzUFCRxpdhYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Call Type" = _t, Count = _t]),
    ChangedType = Table.TransformColumnTypes(Source,{{"Count", type number}}),
    Ad_SuccessCall_Row = Table.InsertRows(ChangedType, 2, {
        [ Call Type = "Success_Call", 
          Count = [ t = Table.SelectRows(ChangedType, (x)=> Text.Contains(x[Call Type], "total", Comparer.OrdinalIgnoreCase))[Count]{0}?,
                    f = Table.SelectRows(ChangedType, (x)=> Text.Contains(x[Call Type], "failed", Comparer.OrdinalIgnoreCase))[Count]{0}?,
                    result = t-f
                  ][result]
        ] } )
in
    Ad_SuccessCall_Row

Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @u4us1923 

Did the solution @dufoq3  provided help you solve the problem, if it helps, please consider to mark it as a solution or you can offer more information.

 

Best Regards!

Yolo Zhu

dufoq3
Super User
Super User

Hi @u4us1923, you can do this easily in Excel but here you go:

 

dufoq3_0-1713367568221.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WKskvScyJT07MyVHSUTI0AAKlWJ1oJbfEzJzUFCRxpdhYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Call Type" = _t, Count = _t]),
    ChangedType = Table.TransformColumnTypes(Source,{{"Count", type number}}),
    Ad_SuccessCall_Row = Table.InsertRows(ChangedType, 2, {
        [ Call Type = "Success_Call", 
          Count = [ t = Table.SelectRows(ChangedType, (x)=> Text.Contains(x[Call Type], "total", Comparer.OrdinalIgnoreCase))[Count]{0}?,
                    f = Table.SelectRows(ChangedType, (x)=> Text.Contains(x[Call Type], "failed", Comparer.OrdinalIgnoreCase))[Count]{0}?,
                    result = t-f
                  ][result]
        ] } )
in
    Ad_SuccessCall_Row

Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.