Welcome to the Power Query Function Library! This repository is a collection of Power Query functions that I have gathered and developed over the years. Some of these functions were found online, but the majority were coded personally.
- functions/: Contains subdirectories categorized by function type. Each
.pqfile implements a single Power Query function and is grouped by category (DateTime, Geo, Math, R, SQL, String, Tbl, Utils, UX).
Note: the previous sharedmaster bundling files have been removed — functions can be used directly from the functions/ folder or imported individually into Power BI / Power Query.
The bundling method used here mimics Kim Burgess's approach of consolidating functions into a single file. This allows for easier management and reuse of code across different projects.
Special thanks to:
- Injae Park: For his innovative method of refreshing code directly from GitHub. Watch his video here.
- John Kerski: For his insightful article on code reuse with Power Query. Read his article here.
-
Clone the repository:
git clone https://github.com/cbaragao/PQ-Shared-Library.git
-
Import a specific function into Power BI / Power Query by opening the
.pqfile and copying the function body into a Blank Query (Advanced Editor), or by using your preferred bundling workflow. -
Right click any function that you want to use to instantiate it and give it an appropriate name.
I used Copilot to put together a wiki for all functions added thus far.
Contributions are welcome! Please fork the repository and submit a pull request with your changes.
This project is licensed under the MIT License.
Feel free to modify this as needed! Let me know if there's anything else you'd like to add or change.
- DateTime:
- ConvertToRoundedDateTime
- Geo:
- MeasureBearing
- MeasureDistance
- Math:
- CalculateEWMA
- GetConfidenceInterval
- GetErlangC
- GetFactors
- NewRandomNumbers
- TestBenford
- R:
- GetLinearModelCoefficients
- InvokeLogitPrediction
- SQL:
- InvokeSQLQuery
- String:
- ConvertToEncodedText
- GetFileText
- RemoveChars
- RemoveHTMLTags
- Tbl:
- AddRandomNumber
- ConvertColumnToList
- ConvertDateTimeZoneToDate
- RoundColumns
- UpdateColumnNames
- Utils:
- GetFunctionMetadata
- NewBatches
- SelectCase
- SelectDynamicList
- UX:
- GetColorHue
- GetColorScheme
- GetCompColor
- GetFontColor
- GetHexValue
- GetLuminosity
- GetMedianAspectRatio
- GetRGBValue
- TestColorBlindness
- TestColorContrast
- TestWebAimContrast
If you want this list exported to a machine-readable file (JSON/CSV) or added to the repository wiki, I can generate that next.