100% нашли этот документ полезным (1 голос)
78 просмотров57 страниц

Ebooks File The Ultimate Guide To Functions in Power Query Omid Motamedisedeh All Chapters

Ultimate

Загружено:

imperavivica
Авторское право
© © All Rights Reserved
Мы серьезно относимся к защите прав на контент. Если вы подозреваете, что это ваш контент, заявите об этом здесь.
Доступные форматы
Скачать в формате PDF, TXT или читать онлайн в Scribd
100% нашли этот документ полезным (1 голос)
78 просмотров57 страниц

Ebooks File The Ultimate Guide To Functions in Power Query Omid Motamedisedeh All Chapters

Ultimate

Загружено:

imperavivica
Авторское право
© © All Rights Reserved
Мы серьезно относимся к защите прав на контент. Если вы подозреваете, что это ваш контент, заявите об этом здесь.
Доступные форматы
Скачать в формате PDF, TXT или читать онлайн в Scribd
Вы находитесь на странице: 1/ 57

Download the full version of the ebook at

https://ebookmass.com

The Ultimate Guide to Functions in Power


Query Omid Motamedisedeh

https://ebookmass.com/product/the-ultimate-guide-
to-functions-in-power-query-omid-motamedisedeh/

Explore and download more ebook at https://ebookmass.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

The Ultimate Guide to Functions in Power Query: Turn Raw


Data into Actionable Insights 1st Edition Omid
Motamedisedeh
https://ebookmass.com/product/the-ultimate-guide-to-functions-in-
power-query-turn-raw-data-into-actionable-insights-1st-edition-omid-
motamedisedeh/
testbankdeal.com

PostgreSQL Query Optimization: The Ultimate Guide to


Building Efficient Queries 2nd Edition Dombrovskaya

https://ebookmass.com/product/postgresql-query-optimization-the-
ultimate-guide-to-building-efficient-queries-2nd-edition-dombrovskaya/

testbankdeal.com

PostgreSQL Query Optimization: The Ultimate Guide to


Building Efficient Queries 2 / converted Edition Henrietta
Dombrovskaya
https://ebookmass.com/product/postgresql-query-optimization-the-
ultimate-guide-to-building-efficient-queries-2-converted-edition-
henrietta-dombrovskaya/
testbankdeal.com

The Ultimate Kid's Guide to the Universe Jenny Marder

https://ebookmass.com/product/the-ultimate-kids-guide-to-the-universe-
jenny-marder/

testbankdeal.com
Microsoft Excel Power Pivot & Power Query For Dummies, 2nd
Edition Michael Alexander

https://ebookmass.com/product/microsoft-excel-power-pivot-power-query-
for-dummies-2nd-edition-michael-alexander/

testbankdeal.com

The Definitive Guide to Gaydon era Aston Martin: The


Ultimate Aston Martin Guide

https://ebookmass.com/product/the-definitive-guide-to-gaydon-era-
aston-martin-the-ultimate-aston-martin-guide/

testbankdeal.com

The Ultimate Price Action Trading Guide

https://ebookmass.com/product/the-ultimate-price-action-trading-guide/

testbankdeal.com

Tools: The Ultimate Guide Jeff Waldman

https://ebookmass.com/product/tools-the-ultimate-guide-jeff-waldman/

testbankdeal.com

Cryptocurrency Trading: The Ultimate Guide to


Understanding the Cryptocurrency Trading Owen Hill

https://ebookmass.com/product/cryptocurrency-trading-the-ultimate-
guide-to-understanding-the-cryptocurrency-trading-owen-hill/

testbankdeal.com
The Ultimate Guide to
Functions in Power
Query
Turn Raw Data into
Actionable Insights

Omid Motamedisedeh
The Ultimate Guide to Functions in Power Query: Turn Raw Data into
Actionable Insights

Omid Motamedisedeh
Brisbane, QLD, Australia

ISBN-13 (pbk): 978-1-4842-9753-7 ISBN-13 (electronic): 978-1-4842-9754-4


https://doi.org/10.1007/978-1-4842-9754-4

Copyright © 2024 by Omid Motamedisedeh


This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or
part of the material is concerned, specifically the rights of translation, reprinting, reuse of
illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way,
and transmission or information storage and retrieval, electronic adaptation, computer software,
or by similar or dissimilar methodology now known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark
symbol with every occurrence of a trademarked name, logo, or image we use the names, logos,
and images only in an editorial fashion and to the benefit of the trademark owner, with no
intention of infringement of the trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if
they are not identified as such, is not to be taken as an expression of opinion as to whether or not
they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of
publication, neither the authors nor the editors nor the publisher can accept any legal
responsibility for any errors or omissions that may be made. The publisher makes no warranty,
express or implied, with respect to the material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Susan McDermott
Development Editor: Laura Berendson
Editorial Project Manager: Jessica Vakili
Copy Editor: Mary Behr
Cover designed by eStudioCalamar
Cover image by Jordy from Pixabay
Distributed to the book trade worldwide by Springer Science+Business Media New York, 1
New York Plaza, Suite 4600, New York, NY 10004-1562, USA. Phone 1-800-SPRINGER, fax (201)
348-4505, e-mail [email protected], or visit www.springeronline.com. Apress Media,
LLC is a California LLC and the sole member (owner) is Springer Science + Business Media
Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.
For information on translations, please e-mail [email protected]; for
reprint, paperback, or audio rights, please e-mail [email protected].
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook
versions and licenses are also available for most titles. For more information, reference our Print
and eBook Bulk Sales web page at www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is
available to readers on GitHub (github.com/apress). For more detailed information, please visit
https://www.apress.com/gp/services/source-code.
Paper in this product is recyclable
To my dear mom and dad, in heartfelt appreciation for
your invaluable support and assistance
Table of Contents
About the Author������������������������������������������������������������������������������xvii

About the Technical Reviewer�����������������������������������������������������������xix

Acknowledgments�����������������������������������������������������������������������������xxi

Introduction�������������������������������������������������������������������������������������xxiii

Chapter 1: Introduction to Power Query�����������������������������������������������1


Introduction to Power Query���������������������������������������������������������������������������������2
Power Query in Excel��������������������������������������������������������������������������������������������4
Power Query in Power BI������������������������������������������������������������������������������������13
Power Query Interface�����������������������������������������������������������������������������������15
M Code����������������������������������������������������������������������������������������������������������������16
Conclusion����������������������������������������������������������������������������������������������������������21

Chapter 2: Data Types�������������������������������������������������������������������������23


Data Types in Power Query���������������������������������������������������������������������������������23
Null����������������������������������������������������������������������������������������������������������������25
Logical Values������������������������������������������������������������������������������������������������25
Numbers��������������������������������������������������������������������������������������������������������26
Time and Date�����������������������������������������������������������������������������������������������27
Text����������������������������������������������������������������������������������������������������������������30
Binary������������������������������������������������������������������������������������������������������������30
List�����������������������������������������������������������������������������������������������������������������30
Record�����������������������������������������������������������������������������������������������������������31

v
Table of Contents

Table��������������������������������������������������������������������������������������������������������������31
Function���������������������������������������������������������������������������������������������������������31
Type Conversion��������������������������������������������������������������������������������������������������32
Converting Values to the Number Format������������������������������������������������������33
Converting Values to the Text Format������������������������������������������������������������34
Converting Values to the Date and Time Format�������������������������������������������35
Converting Values to the Record Format�������������������������������������������������������35
Conclusion����������������������������������������������������������������������������������������������������������36

Chapter 3: Number Functions�������������������������������������������������������������37


Constant Values��������������������������������������������������������������������������������������������������37
Information Functions�����������������������������������������������������������������������������������������38
Rounding Operation��������������������������������������������������������������������������������������������39
Mathematical Operations������������������������������������������������������������������������������������43
Random Generation��������������������������������������������������������������������������������������������45
Trigonometry�������������������������������������������������������������������������������������������������������45
Conclusion����������������������������������������������������������������������������������������������������������45

Chapter 4: Text Functions�������������������������������������������������������������������47


Extracting Part of a Text��������������������������������������������������������������������������������������48
Text.At������������������������������������������������������������������������������������������������������������48
Text.Start�������������������������������������������������������������������������������������������������������49
Text.End���������������������������������������������������������������������������������������������������������50
Text.Range�����������������������������������������������������������������������������������������������������51
Text.AfterDelimiter�����������������������������������������������������������������������������������������52
Text.BeforeDelimiter��������������������������������������������������������������������������������������55
Text.BetweenDelimiters���������������������������������������������������������������������������������57
Text.Select�����������������������������������������������������������������������������������������������������59
Text.Split��������������������������������������������������������������������������������������������������������60

vi
Table of Contents

Removing, Replacing, and Combining Texts��������������������������������������������������������61


Text.Remove��������������������������������������������������������������������������������������������������61
Text.RemoveRange����������������������������������������������������������������������������������������62
Text.PadEnd���������������������������������������������������������������������������������������������������63
Text.PadStart�������������������������������������������������������������������������������������������������65
Text.Replace��������������������������������������������������������������������������������������������������66
Text.ReplaceRange����������������������������������������������������������������������������������������67
Text.Insert������������������������������������������������������������������������������������������������������68
Text.Repeat����������������������������������������������������������������������������������������������������69
Text.Combine�������������������������������������������������������������������������������������������������69
Text Correction����������������������������������������������������������������������������������������������������70
Searching for Characters������������������������������������������������������������������������������������72
Text.StartsWith����������������������������������������������������������������������������������������������72
Text.EndsWith������������������������������������������������������������������������������������������������74
Text.Contains�������������������������������������������������������������������������������������������������75
Text.PositionOf�����������������������������������������������������������������������������������������������76
Text.PositionOfAny�����������������������������������������������������������������������������������������78
Text Conversion���������������������������������������������������������������������������������������������������79
Summary������������������������������������������������������������������������������������������������������������81

Chapter 5: Date and Time Functions���������������������������������������������������83


Date Information�������������������������������������������������������������������������������������������������84
DateTime Information�����������������������������������������������������������������������������������������87
Adding a Value to a Date�������������������������������������������������������������������������������������89
Shifting Dates�����������������������������������������������������������������������������������������������������90
Conversion to Record������������������������������������������������������������������������������������������93
Date Specifications���������������������������������������������������������������������������������������������94

vii
Table of Contents

Date.Day��������������������������������������������������������������������������������������������������������94
Date.DayOfWeek��������������������������������������������������������������������������������������������94
Date.DayOfWeekName�����������������������������������������������������������������������������������95
Date.WeekOfMonth����������������������������������������������������������������������������������������95
Date.WeekOfYear�������������������������������������������������������������������������������������������96
Date.Month����������������������������������������������������������������������������������������������������96
Date.MonthName�������������������������������������������������������������������������������������������97
Date.DayOfYear����������������������������������������������������������������������������������������������97
Date.Year�������������������������������������������������������������������������������������������������������98
Summary������������������������������������������������������������������������������������������������������������98

Chapter 6: List Functions��������������������������������������������������������������������99


Defining a List in Power Query��������������������������������������������������������������������������100
List.Numbers�����������������������������������������������������������������������������������������������103
List.Generate�����������������������������������������������������������������������������������������������104
List.Times����������������������������������������������������������������������������������������������������108
List.Dates�����������������������������������������������������������������������������������������������������109
List.DateTimes���������������������������������������������������������������������������������������������110
List.Random�������������������������������������������������������������������������������������������������111
Sorting Values in a List��������������������������������������������������������������������������������������112
List.Reverse�������������������������������������������������������������������������������������������������112
List.Sort�������������������������������������������������������������������������������������������������������113
Extracting from a List����������������������������������������������������������������������������������������115
List.First and List.Last���������������������������������������������������������������������������������115
List.FirstN and List.LastN����������������������������������������������������������������������������116
List.Range����������������������������������������������������������������������������������������������������118
List.Max and List.Min����������������������������������������������������������������������������������119
List.MaxN and List.MinN������������������������������������������������������������������������������120

viii
Table of Contents

List.Select����������������������������������������������������������������������������������������������������122
List.FindText������������������������������������������������������������������������������������������������123
Removing Values in a List���������������������������������������������������������������������������������124
List.RemoveNull�������������������������������������������������������������������������������������������124
List.Distinct��������������������������������������������������������������������������������������������������125
List.RemoveFirsN and List.RemoveLastN����������������������������������������������������126
List.RemoveRange���������������������������������������������������������������������������������������127
List.RemoveItems����������������������������������������������������������������������������������������128
List.Skip�������������������������������������������������������������������������������������������������������129
List.Alternate�����������������������������������������������������������������������������������������������129
List Merging������������������������������������������������������������������������������������������������������131
List.Combine������������������������������������������������������������������������������������������������131
List.InsertRange������������������������������������������������������������������������������������������132
List.Zip���������������������������������������������������������������������������������������������������������133
List.Union�����������������������������������������������������������������������������������������������������133
List.Intersect������������������������������������������������������������������������������������������������134
List.Difference���������������������������������������������������������������������������������������������135
Mathematical Calculations on the Data of a List����������������������������������������������136
List Information Functions��������������������������������������������������������������������������������139
List.IsEmpty�������������������������������������������������������������������������������������������������140
List.IsDistinct�����������������������������������������������������������������������������������������������140
List.Contains������������������������������������������������������������������������������������������������141
List.ContainsAll��������������������������������������������������������������������������������������������142
List.ContainsAny������������������������������������������������������������������������������������������143
List.AllTrue���������������������������������������������������������������������������������������������������144
List.AnyTrue�������������������������������������������������������������������������������������������������144

ix
Visit https://ebookmass.com
now to explore a rich
collection of eBooks and enjoy
exciting offers!
Table of Contents

Positions in a List����������������������������������������������������������������������������������������������144
List.Positions�����������������������������������������������������������������������������������������������145
List.PositionOf���������������������������������������������������������������������������������������������145
List.PositionOfAny����������������������������������������������������������������������������������������147
Replacing and Transforming Values������������������������������������������������������������������148
List.ReplaceValue����������������������������������������������������������������������������������������148
List.ReplaceMatchingItems�������������������������������������������������������������������������149
List.ReplaceRange���������������������������������������������������������������������������������������151
List.Transform����������������������������������������������������������������������������������������������152
List.TransformMany�������������������������������������������������������������������������������������153
Other Functions�������������������������������������������������������������������������������������������������154
List.Single����������������������������������������������������������������������������������������������������154
List.SingleOrDefault�������������������������������������������������������������������������������������154
List.Repeat���������������������������������������������������������������������������������������������������155
List.Split�������������������������������������������������������������������������������������������������������156
Summary����������������������������������������������������������������������������������������������������������157

Chapter 7: Records���������������������������������������������������������������������������159
Defining a Record���������������������������������������������������������������������������������������������159
Record Properties���������������������������������������������������������������������������������������������162
Record.FieldCount���������������������������������������������������������������������������������������162
Record.FieldNames�������������������������������������������������������������������������������������163
Record.FieldValues��������������������������������������������������������������������������������������163
Record.ToList�����������������������������������������������������������������������������������������������164
Record.Field������������������������������������������������������������������������������������������������164
Record.FieldOrDefault���������������������������������������������������������������������������������165
Record.HasFields�����������������������������������������������������������������������������������������166

x
Table of Contents

Record Correction���������������������������������������������������������������������������������������������167
Record.AddField������������������������������������������������������������������������������������������167
Record.Combine������������������������������������������������������������������������������������������168
Record.SelectFields�������������������������������������������������������������������������������������168
Record.RemoveFields����������������������������������������������������������������������������������170
Record.RenameFields����������������������������������������������������������������������������������172
Record.ReorderFields����������������������������������������������������������������������������������173
Record.TransformFields�������������������������������������������������������������������������������174
Record Conversion��������������������������������������������������������������������������������������������175
Record.FromList������������������������������������������������������������������������������������������175
Record.FromTable����������������������������������������������������������������������������������������176
Record.ToTable��������������������������������������������������������������������������������������������177
Summary����������������������������������������������������������������������������������������������������������177

Chapter 8: Tables������������������������������������������������������������������������������179
Creating a Table������������������������������������������������������������������������������������������������180
Table.FromColumns�������������������������������������������������������������������������������������180
Table.FromRows������������������������������������������������������������������������������������������182
Table.FromRecords��������������������������������������������������������������������������������������185
Table.FromValue������������������������������������������������������������������������������������������187
Table Conversion�����������������������������������������������������������������������������������������������189
Table.ToRecords�������������������������������������������������������������������������������������������190
Table.ToColumns������������������������������������������������������������������������������������������190
Table.ToRows�����������������������������������������������������������������������������������������������191
Table.ToList��������������������������������������������������������������������������������������������������192
Table.Column�����������������������������������������������������������������������������������������������193
Table.TransformRows����������������������������������������������������������������������������������194
Table.Split����������������������������������������������������������������������������������������������������195
Table.SplitAt�������������������������������������������������������������������������������������������������196

xi
Table of Contents

Information��������������������������������������������������������������������������������������������������������197
Selecting Table Rows����������������������������������������������������������������������������������������200
Table.FirstValue�������������������������������������������������������������������������������������������201
Table.First and Table.Last����������������������������������������������������������������������������201
Table.FirstN and Table.LastN������������������������������������������������������������������������202
Table.Max and Table.Min�����������������������������������������������������������������������������204
Table.MaxN and Table.MinN�������������������������������������������������������������������������206
Table.Range�������������������������������������������������������������������������������������������������208
Table.SelectRows����������������������������������������������������������������������������������������209
Table.SelectRowsWithErrors������������������������������������������������������������������������212
Deleting Table Rows������������������������������������������������������������������������������������������214
Table.RemoveFirstN and Table.RemoveLastN����������������������������������������������214
Table.Distinct�����������������������������������������������������������������������������������������������217
Table.Skip����������������������������������������������������������������������������������������������������219
Table.RemoveRows��������������������������������������������������������������������������������������221
Table.AlternateRows������������������������������������������������������������������������������������222
Table.RemoveRowsWithErrors���������������������������������������������������������������������224
Table.RemoveMatchingRows�����������������������������������������������������������������������225
Insert and Replace Table Rows�������������������������������������������������������������������������227
Table.InsertRows�����������������������������������������������������������������������������������������228
Table.ReplaceRows��������������������������������������������������������������������������������������229
Table.ReplaceMatchingRows�����������������������������������������������������������������������231
Table.Repeat������������������������������������������������������������������������������������������������232
Order of rows����������������������������������������������������������������������������������������������������234
Table.ReverseRows�������������������������������������������������������������������������������������234
Table.Sort�����������������������������������������������������������������������������������������������������235
Checking a Condition in All Rows����������������������������������������������������������������������238

xii
Table of Contents

Table.IsDistinct��������������������������������������������������������������������������������������������238
Table.MatchesAllRows���������������������������������������������������������������������������������239
Table.MatchesAnyRows�������������������������������������������������������������������������������241
Table.Contains���������������������������������������������������������������������������������������������242
Table.ContainsAll and Table.ContainsAny����������������������������������������������������244
Table.SingleRow������������������������������������������������������������������������������������������245
Column Names��������������������������������������������������������������������������������������������������246
Table.ColumnNames������������������������������������������������������������������������������������246
Table.DemoteHeaders����������������������������������������������������������������������������������246
Table.PromoteHeaders���������������������������������������������������������������������������������247
Table.HasColumns���������������������������������������������������������������������������������������249
Table.ColumnsOfType����������������������������������������������������������������������������������250
Table.PrefixColumns������������������������������������������������������������������������������������251
Table.RenameColumns��������������������������������������������������������������������������������252
Modifing columns���������������������������������������������������������������������������������������������255
Table.RemoveColumns��������������������������������������������������������������������������������256
Table.SelectColumns�����������������������������������������������������������������������������������259
Table.DuplicateColumn��������������������������������������������������������������������������������263
Table.TransformColumnTypes����������������������������������������������������������������������265
Table.TransformColumns�����������������������������������������������������������������������������267
Table.AddIndexColumn��������������������������������������������������������������������������������271
Table.AddColumn�����������������������������������������������������������������������������������������274
Table.AddRankColumn���������������������������������������������������������������������������������277
Table.SplitColumn����������������������������������������������������������������������������������������281
Table.CombineColumns�������������������������������������������������������������������������������285
Table.CombineColumnsToRecord����������������������������������������������������������������288
Table.ReorderColumns���������������������������������������������������������������������������������290
Table.Pivot���������������������������������������������������������������������������������������������������291

xiii
Table of Contents

Table.Unpivot�����������������������������������������������������������������������������������������������294
Table.Group��������������������������������������������������������������������������������������������������297
Table.Transpose�������������������������������������������������������������������������������������������301
Combining Tables����������������������������������������������������������������������������������������������303
Table.Combine���������������������������������������������������������������������������������������������303
Table.Join����������������������������������������������������������������������������������������������������308
Table.NestedJoin�����������������������������������������������������������������������������������������317
Expanding Columns������������������������������������������������������������������������������������������319
Table.ExpandListColumn������������������������������������������������������������������������������320
Table.ExpandRecordColumn������������������������������������������������������������������������322
Table.ExpandTableColumn���������������������������������������������������������������������������326
Table.AggregateTableColumn����������������������������������������������������������������������329
Replacing Column Values����������������������������������������������������������������������������������330
Table.FillDown and Table.FillUp�������������������������������������������������������������������331
Table.ReplaceErrorValues����������������������������������������������������������������������������334
Table.ReplaceValue��������������������������������������������������������������������������������������337
Finding a Value in a Table����������������������������������������������������������������������������������340
Table.FindText����������������������������������������������������������������������������������������������340
Table.PositionOf�������������������������������������������������������������������������������������������341
Table.PositionOfAny�������������������������������������������������������������������������������������344
Summary����������������������������������������������������������������������������������������������������������345

Chapter 9: Extracting from Data Sources�����������������������������������������347


Folder.Contents�������������������������������������������������������������������������������������������������348
Csv.Document���������������������������������������������������������������������������������������������������349
Excel.Workbook������������������������������������������������������������������������������������������������353
Pdf.Tables����������������������������������������������������������������������������������������������������������355
Sql.Database�����������������������������������������������������������������������������������������������������356

xiv
Table of Contents

Excel.CurrentWorkbook�������������������������������������������������������������������������������������357
Summary����������������������������������������������������������������������������������������������������������357

Chapter 10: Other Functions�������������������������������������������������������������359


if������������������������������������������������������������������������������������������������������������������������360
Combining Conditions����������������������������������������������������������������������������������362
The try Function������������������������������������������������������������������������������������������������366
The let-in Command������������������������������������������������������������������������������������368
Defining a New Function�����������������������������������������������������������������������������������375
Using Defined Function in Other Queries�����������������������������������������������������380

Index�������������������������������������������������������������������������������������������������383

xv
About the Author
Omid Motamedisedeh is a freelance data and
business intelligence analyst with a PhD in
Industrial Engineering. He’s currently working
towards his second PhD at Queensland
University of Technology. Omid is the author
of several articles in industry journals (Electric
Power Systems Research, Journal of Building
Engineering, Energy, Neural Computing and
Applications, and others), and seven books (all
in Farsi) namely Managing Data Entry in Excel by Data Validation, Data
Analysis by Excel’s Pivot Table, Power Query as The Magic of Excel, 222
Most Useful Functions in Excel 2016, Useful Excel Functions in Excel 2019,
Reference of Functions in Excel 2021, and From Drawing Charts to Creating
Dashboards in Excel 2016.

xvii
About the Technical Reviewer
Bo Rydobon (a.k.a. Excel Wizard) is a Microsoft Excel expert and YouTuber
from Thailand who is known for his speed and mastery of Excel. He is also
the creator of the Excel Wizard YouTube channel, where he shares tips and
tricks on how to use advanced dynamic arrays. He actively contributes
on Excelforum.com and became a Top 5 reputation within a few years.
His participation in the Excel BI LinkedIn Excel Challenge drew notable
attention due to his impressive response. In 2022, Bo Rydobon won the
Excel Esports Speedrun organized by the Financial Modeling World Cup.
Bo Rydobon is an inspiration to Excel users all over the world.
He shows that anyone can learn Excel and become an expert, regardless of
their background or experience.

xix
Acknowledgments
I would like to express my sincere gratitude to the individuals who have
played an indispensable role in supporting me throughout the process
of writing this book. My appreciation extends to both those within my
professional circle and those who hold a personal place in my life.
First and foremost, I extend heartfelt thanks to Faranak, whose
unwavering belief in me and encouragement provided the catalyst for
embarking on this writing journey.
I am equally grateful to Bo Rydobon, my esteemed technical reviewer,
whose invaluable insights and motivating feedback have significantly
enriched the quality of this work.
Furthermore, I wish to extend my thanks to the Apress team, including
Susan McDermott (Editorial Director), Shobana Srinivasan (Book
Coordinator), and Shaul Elson (Editorial Manager), for their commendable
professionalism and collaborative approach. Their contributions have
transformed working with Apress into a truly gratifying experience.
Lastly, my profound and enduring appreciation goes to Professor
Hamid Reza Irani, who imparted foundational knowledge of Excel during
my undergraduate years, and to Mike Girvin, a cherished Excel mentor.
Mike's prolific Excel tips shared on the ExcelIsFun YouTube channel have
been a wellspring of learning for all Excel fans like me.

xxi
Visit https://ebookmass.com
now to explore a rich
collection of eBooks and enjoy
exciting offers!
Introduction
In today's data-driven landscape, the ability to seamlessly transform raw
data into meaningful insights is a skill of paramount importance. The
Ultimate Guide to Functions in Power Query stands as a beacon for Excel
and Power BI enthusiasts, equipping them with the tools to unlock the full
potential of their data manipulation endeavors.
In this comprehensive guide, you will delve into the world of Power
Query functions, the building blocks that empower users to effortlessly
manipulate, cleanse, and refine their data. Whether you're a seasoned
data professional or a novice user, this book is designed to elevate your
proficiency in harnessing the capabilities of Power Query functions,
ultimately enabling you to convert seemingly complex datasets into
actionable insights.
Join me on a journey through the intricacies of Power Query functions
as I demystify their functionalities, explore real-world use cases, and
provide step-by-step guidance on their application. With a meticulous
balance of theory and hands-on practice, The Ultimate Guide to Functions
in Power Query is not just a book; it's your indispensable companion in
mastering the art of data transformation.
Chapters include

1. “Introduction to Power Query:” Build a foundation


by learning what Power Query is, its role in data
transformation, and the fundamental concepts that
underpin its functionality.

xxiii
Introduction

2. “Formatting:” Explore the nuances of formatting


data, from standardizing text and numbers to
customizing visual elements.

3. “Number Functions:” Discover a wealth of functions


designed to manipulate and analyze numerical
data, from basic arithmetic operations to advanced
mathematical calculations.

4. “Text Functions:” Uncover the power of text


manipulation with functions that enable you
to extract, concatenate, and transform text in
various ways.

5. “Date and Time Functions:” Navigate the


complexities of date and time data with functions
that facilitate calculations, comparisons, and
conversions, ensuring accuracy in temporal
analysis.

6. “List Functions:” Learn how to work with lists


(ordered collections of values) using functions that
allow you to manipulate, filter, and transform list-­
based data structures.

7. “Record Functions:” Dive into the world of records


(structures that hold multiple fields of data) and
harness functions to modify, extract, and manage
record information.

8. “Table Functions:” Master the art of working with


tables, the heart of data manipulation in Power
Query, using functions that facilitate aggregation,
filtering, and transformation.

xxiv
Random documents with unrelated
content Scribd suggests to you:
PLATE L

Enterolith with Gallstone for a Nucleus; Removed by


Enterotomy. (Richardson.)
This patient was a man of sixty-nine, with symptoms of complete intestinal
obstruction. There was no previous history whatever of gallstone. The impaction
was high up in the small intestine. The gallstone was removed by a small linear
cut which was satisfactorily sutured. The patient died in the course of twenty-
four hours.

Stricture may be recognized by the gradual course of the case and


by a history of increasing difficulty or of increasing constipation. A
stricture as such is not formed within an hour, and in this sense is
the result of a previous more or less active disease. This is true,
also, of cancerous stricture.
6. Intrinsic Neoplasms.—The possibility of both innocent and
malignant tumors occurring within the intestinal structures has
already been considered. It is obvious that any such growth will
cause gradual obstruction by the usual process, or may precipitate
by its presence the occurrence of intussusception, of volvulus, or of
some kinking by which obstruction is suddenly produced.
7. Extrinsic Neoplasms.—What has been said above applies
equally well to growths not primarily involving the intestine, but
encroaching upon it. Thus obstruction may gradually result from
retroperitoneal growths, or from the impaction of a growing uterine
myoma pressing upon the rectum and finally occluding it. Also
cancers growing in various locations encroach upon and finally
involve the bowel in conditions which nevertheless were originally
quite external to it.
8. Gallstones.—In the section devoted to the biliary passages the
accidents which may occur during gallstone disease have been
summarized, and it has there been related how large ones may
ulcerate through and drop into the small or even into the large
intestine. Enteroliths may be thus produced, which were originally
small gallstones that have lodged and grown by accretion until they
have reached considerable size, or by gallstones which have
suddenly entered the intestine by ulceration above, or by other
material which may have collected in some sacculation or
diverticulum, where it has received more or less calcareous deposit
and has grown by accretion until it produces obstruction, either by
occlusion or by causing the intestine to kink. Other foreign bodies
may also produce obstruction. Although it has been generally held
that whatever may escape through the pylorus may be evacuated
from the rectum, nevertheless peculiarly shaped objects become
entangled in such a way as to be checked in progress and serve as
impacted bodies upon which an accumulation may take place. (See
Plate L.)
9. Peritonitis.—While coprostasis is a feature of almost every
case of acute peritonitis the obstruction referred to in this paragraph
comes rather from the adhesion and fixation of bowel from outpour
of lymph than from paralysis and ileus in consequence. It may be
doubted whether acute peritonitis is ever idiopathic. As seen by the
surgeon, at least, it has some point of origin which furnishes ample
excuse for its existence. The most common cause in the male is the
appendix, and in the female the appendix or the tube. At least one-
half of the cases occurring in general practice originate in one or the
other of these ways. Infection may also easily spread from the
mesenteric nodes, beginning locally and resulting in adhesions, the
disease spreading by a natural process until perhaps the whole
abdomen is finally involved. While healthy bowel is ordinarily
impervious to germs, when it becomes diseased germs may easily
travel from its interior to its exterior and thus set up peritonitis. In
this way a purely mechanical original condition may bring about a
fatal septic peritonitis. It is known also that intestinal diverticula are
subject to exactly the same lesions as is that one in particular which
is called the appendix, and the symptoms and sequences of the
diverticulitis may simulate those of an acute appendicitis. In acute
appendicitis coprostasis and even apparently fatal obstruction are
frequently met with. Their occurrence is to be explained not alone by
toxemic paralysis (i. e., toxemic ileus), but by the actual mechanical
impediments offered by loops of bowel strongly bound together
around the appendix in the actual protective effort.
10. Bands.—Bands of tissue which may cause obstruction of the
bowel are neither necessarily long nor large, and one will frequently
be astonished to see how trifling a tissue cord may produce intense
disturbance. The bands which may be found within the abdominal
cavity under these circumstances include those produced by
peritoneal adhesions, where the cohering lymph has organized and
at the same time stretched, such bands being found to arise from
and connect with the bowels alone, to arise from the omentum from
any other causes, particularly traumatic, or to occur at any point
within the peritoneal cavity. They may be single or multiple. When
speaking of Meckel’s diverticulum it was stated how it might be
mistaken for a band extending to the region of the umbilicus, and
acting as one cause of obstruction. (See Fig. 559.) An adherent
appendix or tube tightly attached at its free extremity may also act
as a band, and the former is known to very frequently produce at
least a mild form of intestinal obstruction, which may at any time
assume acute proportions. The pedicle of an ovarian or other tumor
may also, if long, by becoming twisted, include an intestinal loop and
thus produce obstruction.
11. Slits and Apertures.—The mesentery is the occasional site
of fenestra which apparently are of congenital origin. Through such
openings or slits a loop of bowel may easily pass and become
strangulated. The same is true of the omentum. Openings in either
of these structures are perhaps more frequently the result of
traumatisms. Similar conditions result where omental or mesenteric
surfaces have united over small areas, leaving pockets or openings
in which bowel might be caught. Quite a similar condition results in
so-called hernia of bowel into and through the foramen of Winslow.
12. Intestinal Loops and their Traction Effects.—These
causes are not perhaps independent of some of those above
mentioned, yet presuppose a certain looping or abnormal festooning
of intestine, with the further stretching that occurs as the result of
greater loading and the final entanglement of such loops, or their
adhesion, in such a way as to become completely occluded. To this
result some local inflammatory process may contribute. The
condition is often met in connection with pelvic disease of females.
Much that may happen to a loop of bowel which has become
attached to a growing tumor during its migration, as it gradually
changes its shape and position, may be imagined.
—Certain congenital defects predispose to acute obstruction. Among
these are diverticula, as already mentioned, which may produce
trouble, either by incomplete obliteration and separation from the
umbilicus, in which event they act as bands or cords, or by
becoming acutely inflamed, then attaching themselves and indirectly
producing the same effects (Figs. 559 and 562). Even the smaller
diverticula or sacculations which extend between the folds of the
mesentery may, when infected and inflamed, thicken and cause
angular bending of the intestine, with consequent partial
obstruction, which later is made complete by the consequences of
Fig. 562
local peritonitis, with
its dense inevitable
adhesions. Statistics
show that acquired
diverticula occur
twice as often as
Meckel’s, and nearly
as frequently in the
small as in the large
intestine. They are
mostly of the traction
variety and occur at
the mesenteric
border, where they
have close relation to
the bloodvessels, thus
increasing the
dangers of operative
measures because of
possible gangrene
from shutting off
circulation. Porter has
recently collected 188
cases of violent and
even fatal trouble
thus produced within
Strangulation of bowel by a long diverticulum. the abdominal cavity,
(Lejars.) returning an
exceedingly high
13. Congenital Defects.
death-rate after operation, which
unfortunately was almost always done late. In nearly all of these
cases the diverticula were found within the lower four feet of the
ileum. In one case of my own an unobliterated hypogastric artery
caused acute obstruction.
14. Postoperative Obstruction.—Finally cases of postoperative
obstruction are met with in a way to bring disappointment and
disaster when everything else has seemed favorable, and constitute
a clinical type without any distinct pathological foundation. Most of
them are due either to some form of paralytic ileus, or else to local
or general peritonitis with its combined sequels of paralysis and
adhesion by the gluing of portions covered with exudate. Some of
these cases will justify reopening the abdomen, while in others the
condition is absolutely helpless because of the septic element
present.
General Symptoms of Acute Intestinal Obstruction.—
Certain symptoms and signs characterize all cases of acute intestinal
obstruction and may be, therefore, included as common to each;
consequently they may be considered collectively. The cardinal
indications are pain, vomiting, constipation, distention, and collapse.
Pain may be the first indication, and usually is so in invagination,
volvulus, and mechanical obstructions generally. It is usually of
violent paroxysmal character, continuing at least during the earlier
stages, rapidly wearing away the patient’s strength, diminishing as
distention increases and nerve endings become paralyzed.
Vomiting is an early or late feature, according to the portion of the
alimentary canal obstructed. The more prompt its occurrence
presumably the higher in the small bowel the defect. In
consequence of the remedies usually administered it will be found
that when nothing but stomach contents are ejected it is easier to
produce fecal evacuation from below, while the greater the difficulty
in securing a return from the lower bowel the lower the obstruction
and the more likely the vomited material to become fecal in
character. Vomiting once begun is usually continuous until relief is
afforded or the patient utterly exhausted.
Constipation or obstipation sooner or later characterize these
cases. The tenesmus of intussusception, with the passage of bloody
mucus, which may occur in this form, or in volvulus, for instance,
does not imply that the bowel itself is not obstructed, nor does the
emptying of the larger bowel of an accumulated load necessarily
imply that the fecal stream is in motion. Even the passage of flatus
usually is promptly shut off, and it is the gas which forms and cannot
escape that produces the distention.
Distention gradually becomes excessive, the abdomen becoming
ballooned and extremely tympanitic on percussion, while its surface
becomes shiny because so stretched. This meteorism is in large
degree due to the formation of gas within the bowel proper, but is
permitted by the additional features of paralysis of intestinal muscle
and weakening of that of the abdominal wall. As it increases the
diaphragm is pressed upward and respiration is much impeded,
while even the bladder may be compressed below. It affords another
reason why fluid which is taken into the stomach is quickly ejected.
Characteristic collapse comes on more or less promptly, according
to the nature of the exciting cause, and the date of its occurrence is
in some degree an index of its violence.
In dealing with obstructive cases any history that may bear upon
the conditions, as of previous peritonitis, appendicitis, of so-called
dyspepsia which might indicate gallstone disease or gastric ulcer, or
of pelvic conditions which might indicate pyosalpinx or the like,
should be obtained. The manner of onset should be learned,
whether acute or gradual, with the relative date of the occurrence of
pain, vomiting, and stools, along with their character, if there be
anything distinctive therein. Past and present history being secured,
the most methodical examination of the body should be made,
including the physiognomy and general conditions, the attitude
(e. g., whether the knees are drawn up, whether the patient is able
easily to turn), the type of respiration, and the amount of
restlessness. The character of the abdominal movements during
respiration should also be noted, as well as the presence of any
prominence or the indications of violent peristalsis. By palpation the
degree and location of greatest tenderness, the presence of muscle
spasm or of tumor may be learned. Careful examination of all the
ordinary hernial outlets should be made and the rectum and vagina
explored. Revelations thus obtained may also prompt a careful
physical examination of the chest. Percussion will show the presence
of free or localized fluid or gas, while localized dulness may denote a
loop of intestine distended with fluid or impacted feces. Auscultation
will enable the surgeon to hear the sounds produced by violent
peristalsis or to note the absence of movement within the bowel. A
study of the temperature and the pulse may reveal much in certain
cases, especially the inflammatory, and particularly in appendicitis,
while the urine may be examined for indican, and a differential blood
count made.
Meteorism, constipation, and fecal vomiting of themselves indicate
acute obstruction, but furnish no aid as to the nature of the exciting
cause. They are, however, sufficient to indicate the wisdom of
immediate intervention.
Pathologically every case of intestinal obstruction has an interest
of its own. Surgically, however, they are readily grouped as a class
of cases in which operation should always be performed early,
inasmuch as it offers the better prospect of relief and in which death
is the inevitable spontaneous termination. It can scarcely be
imagined how a more distressing case than an acute strangulation
can be allowed to go to its fatal termination without being offered
the prospect of a judicious operation, if only performed early. The
disfavor with which operation is received by the general physician, as
well as by laymen, is due to the fact that too much time is wasted
with futile drug treatment, and that the golden hours when surgical
intervention might save are allowed to pass unutilized. Of most of
these cases it may be said that dying after operation they have died
in spite of it rather than in consequence of it.
This is particularly true with intussusception and volvulus in young
children or infants. Within six hours, in such cases, the harm which
may be done is necessarily fatal, and to keep them for a day or
more, dosing them with cathartics or making strenuous efforts to
relax invagination, is to deprive them of the only measure which
offers them any chance. The disrepute into which operative
treatment of these cases has fallen in certain quarters is due, then,
solely to the fact that the physician does not call the surgeon early,
because there is a time in the history of nearly every one of them
when it could be saved were mechanical relief afforded.
Treatment.—There are certain cases of obstruction by fecal
impaction or lodgement of enteroliths which may be successfully
treated by internal or non-operative means. Could these always be
diagnosticated it would be known when not to operate. But to wait
until paralysis of the bowel has occurred, or gangrene due to stasis,
or perforation have taken place, or septic peritonitis has set in, is to
wait far longer than circumstances justify and reflects on those
responsible for the delay rather than on the operator or the
operation. In general terms, acute intestinal obstruction is always a
surgical disease.
It is not necessary to wait for accurate diagnosis—recognition of
the existence of obstruction alone is all that is required. Conditions
rapidly aggravate themselves, and strength is rapidly lost, if we wait
for more than distinctive symptoms. There is no palliative treatment
save operation, and the drugs and other harsh measures which are
often prescribed serve to intensify and aggravate rather than to
relieve. Anodynes given, though administered with the most humane
intent, serve only to mask conditions and lead to delay.
Exploration once resolved upon, careful judgment must decide as
to where to place the incision. If local indications be present they
may be followed. If there be good reason to believe that the original
cause was an acute appendicitis, then the incision may be placed
upon the right side. In the absence of all indications the surgeon
operates most safely in the middle line by an incision below, above,
or around the umbilicus, as circumstances may indicate. Edema of
the subserous tissue or of the abdominal muscles indicates the
presence of pus beneath. Peritoneum should be sought and opened
with care, as in the presence of much distended bowel injury to the
same may easily occur. The opening once made the operator will be
embarrassed from that time until the conclusion of the operation by
the distention of the bowels—at least those above the obstruction,
and by their being constantly in the way. If a mechanical cause for
obstruction be found it will be noted that the intestine above is more
distended than that below, which latter may be collapsed and
apparently smaller than natural. Thus if a constricting band be
found, or an internal hernia, the removal of the obstructing cause
will permit of prompt restoration of equal gaseous pressure between
the parts above and below.
Scarcely any surgical emergency requires wiser discretion than do
cases of this kind. Bands may be double ligated and divided, kinks
straightened out, twists untwisted, invaginations withdrawn, if this
be possible by reasonable effort. On the other hand the surgeon
should be prepared to find bowel which has apparently lost its
vitality or is actually necrotic, either for a few inches or for several
feet, and he will soon realize that to leave such gangrenous masses
within the abdomen is to accomplish naught, while to remove them
is to subject the patient to a procedure longer and more severe than
he can bear. He must, then, decide whether to close the abdomen
for form’s sake and let the patient die a natural death, or whether to
undertake the risk of resection, or perhaps to leave a considerable
portion of the intestinal canal upon the outside of the body, opening
it and establishing an artificial anus in the hope that the sloughing
portion may be cast off, and that the artificial anus, having served its
purpose, may be subsequently closed by another operation. Such
cases live, though not very often. Here, perhaps as often as
anywhere, can be seen the most desperate expedient succeed and
the most trifling measure fail.
Another question is what to do with distended and paralyzed
intestine, especially when it appears impossible to restore it to the
abdominal cavity. Paralyzed as it is, it is almost too much to hope
that it may recover its tone, and distended as it is, it is practically
unmanageable. To open it at one point would be to empty several
loops, at least of gas and probably of fluid fecal matter, all of which
will help. One cannot but reflect on the toxic nature of all fecal
matter so retained and feel that could it all be evacuated the patient
would, other things being equal, be in vastly better condition. And so
operators have often made openings, taking all possible precautions
to prevent contamination, and have not only evacuated a
considerable length of the intestinal canal, but, as suggested by
Mixter and others, have washed it out.
A more perfect method, however, of accomplishing this purpose
has been suggested by Monks, of Boston, in the use of a large glass
tube, from twenty to twenty-four inches in length, strong and with
smooth ends. He has shown how, an opening having been made,
say just above the obstruction, it is possible by manipulating the
bowel with gauze pads to draw it over the tube (as shown in Fig.
563), to an extent of several feet, and to thus more completely
evacuate it than could be accomplished in any other way. Monks is
undoubtedly entitled to priority for this suggestion over Moynihan,
who has elaborately figured and described it. All in all this permits
better management and more complete effect than any other
method. The bowel having been emptied, the opening is closed by
the usual double row of sutures and is then easily dropped back into
the abdominal cavity. Cases occur where this procedure might be
carried out at two different points, say above and below the
obstruction.
Fig. 563

Method of inserting a tube (through an enterostomy opening) a


considerable distance into the intestine by drawing the intestine around it
with the help of a piece of dry gauze. The tube used in this case has a
curved extremity, the opening being on the concavity of the curve. It is
shown entire at the lower left corner of the illustration. The longer the
abdominal incision and the longer the tube the greater the length of
intestine which may be drawn upon it and emptied of its contents.
(Monks.)
What may be done with the obstruction produced by local and
septic peritonitis, such as is especially seen in acute cases of
cholecystitis, appendicitis, and pyosalpinx? Here the surgeon deals
not only with twisted, kinked, and obstructed bowel, tensely
distended, but with much infected lymph and perhaps a collection of
pus and a gangrenous appendix. Such a condition becomes appalling
and every such case should be dealt with upon its merits. Any
collection of pus should be evacuated and drained, and it must then
be decided whether to endeavor to withdraw entangled loops,
disengage and straighten them out, or to be content with an artificial
anus for temporary purposes, the latter often being the safer course,
even though it may lead to a tedious convalescence and the
necessity for subsequent operation. It might even be advisable to
evacuate pus and remove a sloughing appendix, if it were easily
found, and then make an enterostomy, opening at some other point,
in order to keep the two procedures and fields of activity quite
distinct.
A case may occasionally be seen where the question of affording
some relief is paramount to every other consideration, and where, at
the same time, the patient’s condition is such as to make anything
extra-hazardous. I have saved life under conditions of this kind by
making a simple enterostomy under cocaine, the intent being only to
attach a loop of distended bowel to the parietal peritoneum and to
open it then or a little later, thus establishing an artificial anus. This
may be done with local cocaine anesthesia. I have even seen the
fecal fistula thus produced close spontaneously in the course of time,
and, while the exact character of the lesion was never known, have
had the satisfaction of thus saving a life which I believe would
otherwise have been lost.
One of the most unfortunate accidents that can occur during
operation for acute obstruction is to have the patient practically
drown in his own fecal vomit. This may occur either on the operating
table or soon after leaving it. The term implies simply this—that
there is regurgitation of fecal matter into the stomach, and that as
this is ejected by a patient in his unconscious condition he is not
able to prevent its aspiration into the trachea, with the occurrence of
all that essentially constitutes drowning. Even a few ounces of fluid
material drawn into the lungs, under these circumstances, would be
sufficient to cause asphyxia and death.
The accident is to be prevented not alone by lavage, both before
and at the conclusion of the operation, but by placing the patient
upon his side in such a way that any gush of fluid into the mouth
may escape from it and not be sucked into the lung. The amount of
fluid that may arise is sometimes astonishing. The introduction of
harmless fluid, under these circumstances, would be sufficient, but
the entrance into the lungs of a viscid, offensive, and septic fluid,
even in small quantity, would quickly serve to induce a septic
pneumonia if nothing else. The accident once having occurred,
resuscitation is almost impossible. Under the relaxation of anesthesia
it may occur without outcry and almost unsuspected, and with the
patient on his back, death may be determined even before the
attendant has noticed anything particularly wrong. To prevent this
accident tubes have been devised having balloons around them
which can be inflated with air, to the desired degree, and the
esophagus thus be plugged.
Hence it will be seen that the surgeon should temper his measures
to the condition of the case, its exigencies and its surroundings.
Operation, therefore, may be exceedingly mild or exceedingly
severe, taxing the resources of the best-equipped clinic.
Strangulations recognized from surface indications are usually
dealt with according to standard indications. Those discovered only
after abdominal section are to be dealt with each on its merits.

CHRONIC OBSTRUCTION OF THE BOWEL.


The expressions of chronic obstruction are essentially those of
acute, in which they usually terminate, occurring meantime in milder
degree. Their causes are nowise different from those tabulated
above.
Symptoms.—The symptoms of chronic obstruction are those of
intermittent colic, constipation, perhaps with local tenderness, with
change in shape of the abdomen due to the primary cause or to
intestinal distention, and in many instances with some characteristic
appearance or shape of the feces. Thus the stools are often loose, or
scybalous masses when removed by cathartics, and these are
followed by diarrheal stools containing many gaseous bubbles.
Obstruction of the lower bowel will frequently cause the hardened
fecal masses to assume a tape-like shape. With increasing
obstruction there is increasing severity of symptoms, until finally
they become acute.
Treatment.—The treatment of chronic obstruction is also
operative, either radical or palliative. When the exciting cause can
not only be detected on exploration but removed, it should be
radical. If, however, this be not possible then enterostomy or entero-
anastomosis only can be practised. Thus in cancer of the rectum or
sigmoid, colostomy is the last resort. In cancer of the bowel above
the sigmoid anastomosis may relieve the obstruction and permit the
patient to linger until he dies of the natural progress of the disease.
Here, as elsewhere, operation should not be too long delayed. To
wait for a chronic obstruction to merge into one of the acute forms,
and then to wait until the patient is moribund, is to have deliberately
deprived him of that which otherwise might have prolonged his life.
For chronic obstruction whose cause is not easily revealed the
hypothesis of cancer affords the most common explanation. This
may be intrinsic or extrinsic, so far as the bowel itself is concerned,
the results however not differing. It matters but little whether cancer
is producing an annular stricture or involving a considerable extent
of bowel, something should be done. When health has gradually
failed, and obstructive symptoms have come on slowly, and when
distinct cachexia is present the presence of cancer within the
abdomen may be suspected. When a distinct tumor is palpable or
when the abdomen gradually fills with fluid there is little doubt.
When to these signs is added pigmentation of the abdominal wall
the diagnosis may be considered certain. Even now exploratory
section is justified, in the hope that some operative measure may
offer comfort and at least temporary relief.
On the other hand, when obstructive symptoms appear and
increase without the accompaniment of other serious indications, it
may be hoped that the condition is benign rather than malignant.
Obstruction with ascites may possibly be due to tuberculous lesions,
which are not uncommon, especially in children. The recognition of
enlarged mesenteric nodes would corroborate this diagnosis. A
history of typhoid fever or of injuries or foreign bodies might confirm
the theory of cicatricial stenosis. The possibility of enteroptosis of
the colon and impaction of hardened fecal matters should not be
disregarded and that of enteroliths, especially gallstones, not
forgotten.

FECAL FISTULA; ARTIFICIAL ANUS.


A fecal fistula implies any communication between the intestinal
tract and the exterior of the body or one of its other cavities. Thus it
is possible to have a rectovaginal fistula as well as a vesicovaginal.
In rare instances we may meet also with intestinal communication
with the bladder, the other viscera, or even the pleura or lungs.
Fecal fistulas are always abnormal productions, and result either
from congenital causes, previous injury, or disease. Among the
traumatic causes may be mentioned penetrations or ruptures of the
intestines, injuries to the bowel occurring in the course of abdominal
operations (for instance, the inclusion of some part of the bowel wall
within a ligature or suture), while the pathological causes include the
possibilities of perforation of any form of ulcerative lesion, cancer,
actinomycosis, or the secondary sloughing which may follow
appendicitis, or even the pressure of a drainage tube. Fistulas result
also from escape of foreign bodes (for instance enteroliths or bone
fragments), which may work their way into some other viscus, or out
through the abdominal wall to the body surface. Old pelvic and
abdominal abscesses also occasionally cause perforation and fecal
fistulas. These fistulous tracts may be long or short, and direct or
indirect. They may also permit the escape of a large amount of fecal
matter or the smallest appreciable amount. The majority of them
tend to close spontaneously in the course of time, but this time is
sometimes so prolonged that a surgical operation is preferable to
waiting for natural processes. The communications may be high in
the intestinal canal. In such a case matter that escapes will be but
partially digested and will have the character of chyme rather than of
feces; and patients suffer in consequence, as products of digestion
are not complete and opportunities for absorption have been too
limited, and they are deprived of all that should normally happen
further along in the bowel. In such a case there is temptation to
operate much earlier than is advisable. Another form of fistula
results from certain cases of strangulated hernia, in consequence of
necrosis of the strangulated loop of bowel. In fact this is true of any
of the mechanical causes of acute obstruction, where this expedient
may be resorted to under compulsion and we produce a fistula as an
emergency measure.
The difference between intestinal or fecal fistula and artificial anus
is that the former is an undesirable and untoward event, whereas
the latter is deliberately produced by operation practised for the
purpose. Artificial anus is in the main limited to cases of cancerous
or other hopeless or inoperable obstruction of the lower bowel, and
in such case is purely a palliative measure. It is made occasionally at
the upper end of the colon in order to give a diseased colon
physiological rest and permit of more perfect irrigation of that tube,
the intent being to later close the opening. It is an inevitable
emergency measure in certain cases of acute obstruction, where the
patient is in no condition to bear anything more extensive or
prolonged.
The operation for making an artificial anus, usually referred to as
enterostomy or colostomy, will be described below.
Fecal fistulas should be treated largely according to their causes;
when they are the product of actinomycotic or cancerous disease
little can be done, and perhaps nothing should be. On the other
hand, when resulting from traumatism, from sloughing of some
portion of the bowel, or from strangulation, much can be
accomplished.
A small, fistulous tract should be kept clean and stimulated
occasionally with silver nitrate or something of the kind, and perhaps
by introducing into it every day a small piece of gauze, which
provokes the granulation process as well as fills the opening. It is
bad practice, however, to simply close the outer end and let the
lower portion distend with feces. Much will depend upon whether it
now connects with the bowel. This may be determined by injecting
into the fistula some methyl blue and then noting the subsequent
stools. When communication with the bowel is evidently free the
surgeon may feel like making a deeper operation, perhaps with
intestinal suture or even intestinal resection, whereas if there be
little or no actual fecal leakage it may be sufficient to enlarge the
outer end of the fistula, to thoroughly scrape it with the sharp
spoon, and then, lightly packing it, see it close with granulations. A
passage-way which is exceedingly short may be treated by simple
superficial plastic operation, including freshening of the entire
margin of the opening and the passage around it, and a purse-string
suture, with or without a circular incision of the skin. By drawing this
suture tight the external opening may be closed. This is a neat way
in which to dispose of a small fistulous opening resulting from a
previous enterostomy or appendicitis operation.
A rectovaginal fistula may be closed by formal operation, similar to
that for closure of a vesicovaginal fistula, based upon the simple
principle of freshening the edges of the opening and then holding
them together with suitably placed sutures. A rectovesical fistula
would, in most instances at least, require a laparotomy, with careful
separation of the rectum from the bladder, and then a separate
suture of each opening. Such an operation might be quite difficult,
made so not by its plan of performance but by the conditions which
necessitated it. Any bladder thus attacked should be kept perfectly
empty for several days by the use of a self-retaining catheter. Every
case of fecal communication with any large abscess cavity, or
through the diaphragm, directly or indirectly, as with a bronchus,
should be treated on its individual merits, it being a grave question
whether operation would be indicated or not.
Certain fecal fistulas will justify more formidable operation, in
which, after opening the abdomen and carefully protecting its
contents against contamination, the adhesions should be separated
entirely and that portion of the bowel which is involved removed,
making either an end-to-end suture or a lateral approximation. If
this be done it will be best also to completely excise the old fistulous
tract through the abdominal wall, and to remove everything that was
involved in the previous condition.
It is possible to atone for almost every opening of this character,
save those produced by some seriously malignant disease. If such a
condition be the result of cancerous extension then it is practically
hopeless.

OPERATIONS UPON THE INTESTINE.


Intestinal Suture.—Intestinal suture is by no means a new or
modern operation. It was spoken of by the ancient writers and was
evidently practised in the middle ages by the “Four Masters” of the
School of Salernum and their followers. But until it was reduced to a
science by the French surgeons, Jobert and Lembert, during the first
quarter of the past century, it was always a hazardous measure.
Success with intestinal suture depends upon exact hemostasis of the
edges to be united and their accurate approximation in layers (i. e.,
mucosa to mucosa and serous and muscular coat to its like). Save
when haste compels, this accurate application is effected by two
distinct suture rows, the first or deeper (of hardened gut) made to
include the mucosa alone, the suture being usually continuous, but
knotted at intervals, with stitches close together and drawn tightly to
amply secure against leakage from the relatively large vessels of this
membrane. It is better to apply this row by itself, as any suture
drawn through the mucosa and out again through the serous coat is
liable to contaminate the latter, it being much better to keep the
contaminated row of sutures distinct. The first row having been
applied and the surface carefully cleansed the operator may then
coapt the balance of the annular wound by a continuous row of fine
silk sutures, made to include the serous and muscular coats and to
avoid the mucosa. The stomach and the colon are sufficiently thick
to take a row of rather coarse sutures for this purpose, but most of
the small intestine is so thin-walled that these need to be applied
with caution as well as with dexterity.
Every row of sutures should be so applied and directed that the
lumen of the bowel be not reduced by its presence, it being a
serious matter to greatly encroach upon the diameter of the bowel,
since obstruction will thereby be favored and extra tension made
upon the sutures (Figs. 564 and 565).

Fig. 564

Application of the interrupted Lembert suture. (Richardson.)


Fig. 565

The continuous Lembert stitch. (Richardson.)

So many different forms of intestinal suture have been devised


that it is useless to attempt here to describe them all.
Any minute puncture of the bowel may be closed by purse-string
suture. Any perforating wound should be not only first carefully
cleansed, but also slightly enlarged, cutting away its more or less
contused margins in order that fresh, viable tissue may be exposed.
This is particularly true of gunshot wounds. Many of the operations
now practised include inversion of the end of the bowel, a method
illustrated in Fig. 566, showing a method equally applicable to
burying the stump after removing the appendix, closing the end of a
portion of the small or even the large bowel.
Most operators now use for the mucosa a carefully prepared and
reliable chromicized catgut, the smaller size being preferable, with
the ends cut short after the knots are tied. It is well also to use for
intestinal suture needles which are round rather than made with
cutting edges, as by the latter openings are made larger and vessels
sometimes cut, this requiring the insertion of extra sutures for their
securement. Whether the operator shall use curved or straight
needles, and shall do the work with his fingers or depend upon
various forms of needle holders, is purely a matter of choice and
training. Success or failure depend not so much upon the needle
holder as upon the holder of the needle, and his care and attention
to detail. In the presence of multiple lesions the procedure may have
to be repeated to meet each indication.
Anastomotic Operations.—For the general application of the
principle of anastomosis to intestinal work the profession is largely
indebted to Senn. The principle having been once recognized will
never be rejected, but methods have already varied much from
those first introduced, and will be improved by the substitution of
simpler procedures for the more complex.
In general an anastomotic opening may be made between any
distinct portions of the alimentary canal, and almost any one part
may be thus, as it were, connected up with any other.
Gastrojejunostomy has already been described. Only under
compulsion does one thus connect the stomach with any other part
of the alimentary canal. From the jejunum down to the rectum one
may, however, effect attachments of this kind at any desired point.
These operations are in the main done for one of the following
purposes:
(a) In cases of obstruction of the bowel;
(b) For the purpose of exclusion of a certain length; or
(c) As a substitute for end-to-end reunion, after resection of a
portion of the bowel.
The method of performance will depend not so much upon the
nature of the difficulty requiring the operation as upon the condition
of the patient, the equipment, and the operative skill of the surgeon.
With a patient in extremely serious condition that method which may
be most quickly performed is obviously the best. When time and
method are under control, then that is best which can be most
perfectly performed by the operator, or that which he is compelled to
adopt, as when, for instance, he resorts to a suture method because
he has no button at hand.
In order to simplify the subject as much as possible the following
methods alone will be mentioned here:
The method by suture is essentially similar to that described as
gastro-anastomosis, the surfaces which are to be brought together
being properly placed, and approximated, first, by a row of silk
suture, the openings being then made with excision of a strip of
mucosa, and the mucosa being next sutured with chromic gut, first
on the further side, then on the near side of the opening, after
which the serous membranes are accurately sutured around the
opening by continuation of the first row of silk sutures. The actual
opening made for the purpose should be at least an inch in length,
preferably an inch and a half or more, while when the lower bowel is
attached to the colon such an opening may well have a length of at
least 2¹⁄₂ inches, for if successful it will be followed by a certain
degree of cicatricial contraction and will never remain of its original
size (Figs. 566, 567, 568 and 569). The suture may be combined
with the elastic ligature, the method again being similar to that for
uniting the jejunum with the stomach, already described. The rubber
ligature used for the purpose is of the same size, and there is no
difference to be made in the directions already given. The elastic
ligature, however, can not be relied upon in emergency cases where
it is necessary to effect a communication at once. It is serviceable
only in instances where there is a leeway of at least three or four
days. This method has for one of its advantages the fact that in its
performance it is not necessary to clamp or secure the bowel by any
instrument, simply to empty it for the moment with the fingers, it
not being opened during the operation by anything save the needle
puncture, which is promptly filled with the rubber. It does require,
however, that the rubber used for the purpose shall be reliable and
new, it being unfortunately the case that pure rubber which will last
for a long time is seldom found in the market.
Fig. 566 Fig. 567

Entero-anastomosis of intestinal Suture of the distal edges of the


loops which have been resected and mucosa.
the bowel ends closed; the first row
of sutures has been applied and the
line of opening indicated. (Lejars.)
Fig. 568 Fig. 569

Insertion of the last (fourth) row of Resection of intestine with lateral


sutures. (Lejars.) anastomosis. Posterior suture inserted.
The free ends of the bowel inverted and
sutured. (Richardson.)

The button method depends for its success upon a mechanical


device of Murphy, known everywhere as the “Murphy button,” or
upon one of its modifications. Fig. 570 illustrates the component
parts of this device, which is made in various sizes and, in fact, in
various shapes for different purposes, though the circular forms
suffice for practically all cases. In Fig. 572 it is seen in actual use,
while Figs. 573 and 574 illustrate the method of its insertion and
securement.
Fig. 570

The Murphy button.


Fig. 571

End-to-end union of intestine by means of the Murphy button: the two portions of
the Murphy button, held in position by purse-string sutures, are ready to be
pressed together. (Richardson.)

Fig. 572

Union—end to end—with the Murphy button.

The underlying principle of the Murphy button is that each half can
be inserted separately and that then, by pressing these halves
together, an opening is at once afforded from one part of the bowel
to the other. If the halves be pressed together with the proper
degree of firmness they produce, first, adhesion between
considerable areas around their circumference, followed in the
course of a few days by a necrosis of the central portion, which
sloughs because deprived of its circulation by the pressure. So soon
as this separation or sloughing is complete the button drops into the
intestinal canal, being completely loosened, and is now carried along
by peristalsis and by the fecal current from above, its position
shifting as would that of a scybalous mass or a fecal concretion, until
it finally emerges from the intestinal tube, being passed from the
anus. How soon it will thus appear will depend in large measure
upon the point of the intestinal canal into which it is thus intruded. If
this be high up it will be slower in appearing. If low down it may be
expected sooner. While it usually appears within ten days or two
weeks it may, however, be longer retained, and in one case of my
own was not passed for three months, although the anastomosis
was made with the ascending colon, into which it must have
dropped.
Fig. 573 shows one of the halves held in the grasp of a forceps,
being inserted into a small buttonhole opening just large enough to
receive it, around which there has been passed a buttonhole or
purse-string suture of silk. This portion once thus inserted should not
be lost within the bowel, it being necessary to retain control of it by
the forceps until its application to the other half. Both halves being
inserted and brought opposite to each other, as in Fig. 574, the
smaller is introduced into the larger, and they are then pressed
together until the included serous surfaces are brought into contact,
with sufficient pressure inflicted to bleach them, in order that their
subsequent necrosis may be ensured. A circular row of sutures
should now be placed around the surfaces thus applied, in order to
more widely secure them in contact. The procedure being completed
in this way, the parts are dropped back into the abdomen and the
abdominal wound closed.
Fig. 573

Introduction of one-half of a Murphy button. (Bergmann.)


Fig. 574

Intestinal anastomosis with a Murphy button, showing the halves in position ready
to be pushed together. (Bergmann.)

End-to-end reunion can be accomplished by the same method, or


the end of the small intestine may be applied to the side of the
large, after a method which will be best understood by reference to
Fig. 571, it being necessary here to draw the squarely cut end of the

Вам также может понравиться