### Power Fx Function Example Template Source: https://github.com/pnp/powerfx-samples/blob/main/samples/README-template.md Provides an example usage template for a custom Power Fx function, demonstrating how the function call should be presented in the documentation. ```Power Fx MyCustomFunction(MyParameterName) ``` -------------------------------- ### Get Start of Week (Power Fx) Source: https://github.com/pnp/powerfx-samples/blob/main/samples/date-functions/readme.md Gets the first day of a week based on a given date. ```excel StartOfWeek(StartDate) ``` -------------------------------- ### Syntax for StartOfWeek in Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/date-functions/readme.md Gets the first day of the week for a given date. It can optionally add a number of weeks and specify the day considered the start of the week. It requires a StartDate (DateTime) and optionally accepts AddWeeks (Number) and DayWeekStart (Number). The function returns a Date. ```Power Fx StartOfWeek(StartDate [, AddWeeks, DayWeekStart]) ``` -------------------------------- ### Calculating Present Value (PV) Example 2 in Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/financial-functions/readme.md Another example calculating the present value of an investment based on a rate (6%), number of periods (18), and periodic payment (50000). The future value is omitted, defaulting to 0. ```Power Fx PV(0.06, 18, 50000) ``` -------------------------------- ### DaysOfWeek Function - Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/date-functions/readme.md Get the days of a week. This function returns a table containing the days of the week starting from the specified StartDate. Optional parameters allow adding weeks and specifying the start day of the week. ```Power Fx DaysOfWeek(StartDate [, AddWeeks, DayWeekStart]) ``` -------------------------------- ### Syntax for StartOfYear in Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/date-functions/readme.md Gets the first day of the year for a given date. It can optionally add a number of years to the StartDate. It requires a StartDate (DateTime) and optionally accepts AddYears (Number). The function returns a Date. ```Power Fx StartOfYear(StartDate [, AddYears]) ``` -------------------------------- ### Define and Use BinaryToDecimal Function Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/convertbasenumber-functions/README.md Defines the syntax for the BinaryToDecimal function which converts a binary number to a decimal number. It takes one parameter, 'Binary', a required Number value representing the binary number. The function returns a Number. Includes an example demonstrating its usage. ```Power Fx BinaryToDecimal(Binary) BinaryToDecimal(1101) ``` -------------------------------- ### Define and Use DecimalToBinary Function Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/convertbasenumber-functions/README.md Defines the syntax for the DecimalToBinary function which converts a decimal number to a binary number. It takes one parameter, 'Decimal', a required Number value. The function returns a Number. **CAUTION**: There is a known bug in Power Apps affecting this function when called from a custom function, causing incorrect conversions for certain numbers. Includes an example demonstrating its usage. ```Power Fx DecimalToBinary(Decimal) DecimalToBinary(345) ``` -------------------------------- ### Define and Use HexToDecimal Function Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/convertbasenumber-functions/README.md Defines the syntax for the HexToDecimal function which converts a hexadecimal string to a decimal number. It takes one parameter, 'Hex', a required Text value representing the hexadecimal number. The function returns a Number. Includes an example demonstrating its usage. ```Power Fx HexToDecimal(Hex) HexToDecimal("5A") ``` -------------------------------- ### Get JSON Differences as Table Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/table-functions/README.md This function compares two JSON objects representing single records and returns a Power Fx Table containing only the fields that have changed. It takes two parameters: 'jsonBefore' and 'jsonAfter', both JSON objects as Text. The output is a Table with columns 'FieldName' (Text), 'OldValue' (Text), and 'NewValue' (Text). This function is useful for detecting changes before submitting data. ```Power Fx JsonDiffToTable(jsonBefore, jsonAfter) ``` ```Power Fx With( { before:JSON( { "bsc_field1": "value1", "bsc_field2": "value2", "bsc_field3": "value3" }), after: JSON({ "bsc_field1": "value1", "bsc_field2": "value3" }) }, ClearCollect( Metadata, TableUtils_1.JsonDiffToTable(before,after) ); ) ``` -------------------------------- ### EndOfWeek Function - Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/date-functions/readme.md Get the last day of a week. This function calculates the end date of the week containing the provided StartDate. Optional parameters allow adding weeks and specifying the start day of the week. ```Power Fx EndOfWeek(StartDate [, AddWeeks, DayWeekStart]) ``` -------------------------------- ### Detecting Circle-Circle Collision in Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/collisiondetection-functions/README.md This snippet demonstrates using the `CircleCircle` function to check for collision between two circular controls. It requires the X, Y, and Radius of each circle. The example calculates the radius from the Width property (assuming Width = Height = Diameter). ```Power Fx CircleCircle( Circle1.X, Circle1.Y, Circle1.Width / 2, Circle2.X, Circle2.Y, Circle2.Width / 2 ) ``` -------------------------------- ### Define and Use DecimalToHex Function Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/convertbasenumber-functions/README.md Defines the syntax for the DecimalToHex function which converts a decimal number to a hexadecimal string. It takes one parameter, 'Decimal', a required Number value. The function returns a Text value. Note that values greater than 16^12 - 1 may not be converted correctly due to precision limitations in Power Apps. Includes an example demonstrating its usage. ```Power Fx DecimalToHex(Decimal) DecimalToHex(123) ``` -------------------------------- ### EndOfMonth Function - Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/date-functions/readme.md Get the last day of a month. This function calculates the end date of the month containing the provided StartDate. An optional parameter allows adding a specified number of months. ```Power Fx EndOfMonth(StartDate [, AddMonths]) ``` -------------------------------- ### EndOfYear Function - Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/date-functions/readme.md Get the last day of a year. This function calculates the end date of the year containing the provided StartDate. An optional parameter allows adding a specified number of years. ```Power Fx EndOfYear(StartDate [, AddYears]) ``` -------------------------------- ### EndOfQuarter Function - Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/date-functions/readme.md Get the last day of a quarter. This function calculates the end date of the quarter containing the provided StartDate. An optional parameter allows adding a specified number of quarters. ```Power Fx StartOfQuarter(StartDate [, AddQuarters]) ``` -------------------------------- ### Checking if Date is in Current Week using Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/date-functions/readme.md This snippet shows the syntax for the `IsInCurrentWeek` function in Power Fx. It checks if the specified date (`EvaluateDate`) falls within the current week, allowing specification of the week's starting day (`DayWeekStart`). Both parameters are required. The function returns a Boolean result. ```excel IsInCurrentWeek(EvaluateDate, DayWeekStart) ``` -------------------------------- ### Initializing Local Repository (Shell) Source: https://github.com/pnp/powerfx-samples/blob/main/CONTRIBUTING.md Creates a new directory for the repository, navigates into it, and initializes a new empty Git repository. This is the first step when merging an existing project. ```shell md powerfx-samples cd powerfx-samples git init ``` -------------------------------- ### Power Fx Function Syntax Template Source: https://github.com/pnp/powerfx-samples/blob/main/samples/README-template.md Illustrates the syntax structure for documenting a custom Power Fx function within the sample template, showing the function name and a placeholder parameter. ```Power Fx MyCustomFunction(MyParameterName) ``` -------------------------------- ### Markdown Syntax for Author with Twitter and Company Source: https://github.com/pnp/powerfx-samples/blob/main/CONTRIBUTING.md Provides the recommended Markdown syntax for listing an author's name, Twitter handle, and company name in the README file's Authors section. ```Markdown folder name | Author Name ([@yourtwitterhandle](https://twitter.com/yourtwitterhandle)), Company Name ``` -------------------------------- ### Adding Existing Project as Subtree (Shell) Source: https://github.com/pnp/powerfx-samples/blob/main/CONTRIBUTING.md Adds another Git repository (your existing project) as a subtree into a specific directory within the current repository (the samples folder). This integrates the project's history into the main repository. ```shell git subtree add --prefix=samples/projectname https://github.com/yourgitaccount/projectname.git main ``` -------------------------------- ### Adding Remote and Pulling Fork (Shell) Source: https://github.com/pnp/powerfx-samples/blob/main/CONTRIBUTING.md Adds a remote named 'origin' pointing to your forked repository on GitHub and pulls the 'main' branch from your fork into the local repository. ```shell git remote add origin https://github.com/yourgitaccount/powerfx-samples.git git pull origin main ``` -------------------------------- ### Markdown Syntax for Author with Twitter Handle Source: https://github.com/pnp/powerfx-samples/blob/main/CONTRIBUTING.md Provides the recommended Markdown syntax for listing an author's name along with their Twitter handle in the README file's Authors section. ```Markdown folder name | Author Name ([@yourtwitterhandle](https://twitter.com/yourtwitterhandle)) ``` -------------------------------- ### Pushing Branch to Fork (Shell) Source: https://github.com/pnp/powerfx-samples/blob/main/CONTRIBUTING.md Pushes the local feature branch to your personal fork on GitHub. This makes the branch available for creating a pull request against the main repository. ```shell git push origin mycustomfunction ``` -------------------------------- ### Creating a New Feature Branch (Shell) Source: https://github.com/pnp/powerfx-samples/blob/main/CONTRIBUTING.md Creates and switches to a new Git branch based on the 'main' branch. It's recommended to make contributions on a dedicated branch to isolate your changes. ```shell git checkout -b mycustomfunction main ``` -------------------------------- ### Syncing Fork with Upstream Main (Shell) Source: https://github.com/pnp/powerfx-samples/blob/main/CONTRIBUTING.md Updates your local 'main' branch to match the upstream repository's 'main' and then rebases your feature branch onto the updated 'main'. This ensures your changes are based on the latest version of the repository. ```shell # assuming you are in the folder of your locally cloned fork.... git checkout main # assuming you have a remote named `upstream` pointing official **powerfx-samples** repo git fetch upstream # update your local main to be a mirror of what's in the main repo git pull --rebase upstream main # switch to your branch where you are working, say "mycustomfunction" git checkout mycustomfunction # update your branch to update it's fork point to the current tip of main & put your changes on top of it git rebase main ``` -------------------------------- ### Pushing Merged Changes (Shell) Source: https://github.com/pnp/powerfx-samples/blob/main/CONTRIBUTING.md Pushes the changes, including the added subtree, from the local repository up to your forked repository on GitHub. This makes the merged project available in your fork. ```shell git push origin main ``` -------------------------------- ### Checking and Adding Upstream Remote (Shell) Source: https://github.com/pnp/powerfx-samples/blob/main/CONTRIBUTING.md Checks if an 'upstream' remote exists pointing to the main repository and adds it if not present. This is necessary to sync your fork with the original repository. ```shell # check if you have a remote pointing to the Microsoft repo: git remote -v # if you see a pair of remotes (fetch & pull) that point to https://github.com/pnp/powerfx-samples, you're ok... otherwise you need to add one # add a new remote named "upstream" and point to the Microsoft repo git remote add upstream https://github.com/pnp/powerfx-samples.git ``` -------------------------------- ### Calculate Color Contrast Ratio (Power Fx) Source: https://github.com/pnp/powerfx-samples/blob/main/samples/color-functions/README.md This Power Fx formula calculates the contrast ratio between two colors based on their relative luminance values. It determines which color has higher luminance and applies the contrast formula ((Lighter + 0.05) / (Darker + 0.05)). The result is formatted as text with three decimal places. Inputs are the relative luminance values of the dark and light colors, and the output is a text string representing the contrast ratio between 1 and 21. ```Excel Formula If( // Check which Value is higher, calculation then is (darkColor+0.05) / (lightColor+0.05) LightColor >DarkColor, Text( Sum((LightColor + 0.05) / (DarkColor + 0.05)), "[$-en-GB]#.000" ), Text( Sum((DarkColor + 0.05) / (LightColor + 0.05)), "[$-en-GB]#.000" ) ) ``` -------------------------------- ### Calculating Present Value (PV) in Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/financial-functions/readme.md Calculates the present value of an investment using the PV function with parameters interpreted as Rate (50000), NPER (0.08), and PMT (20). Note: The parameter values appear unusual for typical financial calculations based on the documented syntax PV(Rate, NPER, PMT [, FV]). ```Power Fx PV(50000, 0.08,20) ``` -------------------------------- ### Convert length unit (Power Fx) Source: https://github.com/pnp/powerfx-samples/blob/main/samples/geolocation-utils/README.md Performs unit conversion for a given length value. Requires a number parameter for the length, a text parameter for the target unit (acceptable values: m, cm, km, inch, feet, yard, mile), and an optional number parameter for decimal point precision. Returns a record containing the converted length in various units as properties. ```excel ConvertUnit(Length, Unit, DecimalPoint) ``` ```excel {cm: 315040975.26, feet: 10335990, inch: 124031880.02, km: 3150.41, m: 3150409.75, mile: 1957.58, yard: 3445330} ``` -------------------------------- ### Syntax for WeekOfMonth in Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/date-functions/readme.md Calculates the week number (1-6) within the month for a given date. It requires a StartDate (DateTime) and a DayWeekStart (Number) to specify the first day of the week. The function returns a Number. ```Power Fx WeekOfMonth(StartDate [,DayWeekStart]) ``` -------------------------------- ### Calculate distance and heading between two points (Power Fx) Source: https://github.com/pnp/powerfx-samples/blob/main/samples/geolocation-utils/README.md Calculates the distance in meters and the compass heading between two geographical points specified by their latitude and longitude. The heading is measured clockwise from North (0 degrees). Requires four number parameters: Lat1, Lng1, Lat2, and Lng2. Returns a record containing the calculated distance and heading properties. ```excel TwoPoints(Lat1, Lng1, Lat2, Lng2) ``` ```excel { distance: 13245.12445, heading: 99.234 } ``` -------------------------------- ### Calculate Relative Luminance (Power Fx) Source: https://github.com/pnp/powerfx-samples/blob/main/samples/color-functions/README.md This Power Fx formula calculates the relative luminance of a color from its linearized R, G, and B values. It uses weighted sums based on standard coefficients (0.2126 for R, 0.7152 for G, 0.0722 for B). It depends on the 'sRGBtoLIN' function to provide the linearized inputs. The inputs are linearized R, G, and B values, and the output is a number between 0 and 1 representing the luminance. ```Excel Formula Sum( ('color-functions'.sRGBtoLIN(R) * 0.2126) + ('color-functions'.sRGBtoLIN(G) * 0.7152) + ('color-functions'.sRGBtoLIN(B) * 0.0722) ) ``` -------------------------------- ### Validate Percent Format in Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/regex-functions/README.md This Power Fx function checks if a given text value conforms to a percent format using a regular expression. It takes one parameter, the text to be evaluated, and returns a boolean result. ```Power Fx IsPercent(PercentTxt) ``` -------------------------------- ### Syntax for WeekOfYear in Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/date-functions/readme.md Calculates the week number (1-54) within the year for a given date. It requires a StartDate (DateTime) and a DayWeekStart (Number) to specify the first day of the week. The function returns a Number. ```Power Fx WeekNumber(StartDate [,DayWeekStart]) ``` -------------------------------- ### Validate Percent Format in Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/regex-functions/README.md Regex to validate percent format. Requires the 'PercentTxt' parameter, which is the text value to evaluate. Returns a Boolean indicating if the format is valid. ```Power Fx IsPercent(PercentTxt) ``` -------------------------------- ### Convert JSON Object to Table Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/table-functions/README.md This function transforms a JSON object representing a single record into an equivalent Power Fx Table. It takes a single parameter, 'json', which is the JSON object as Text. The output is a Table with columns 'Name' (Text) and 'Value' (Text). This can be useful for debugging purposes. ```Power Fx JsonToTable(json) ``` ```Power Fx With( { jsonData: JSON({ "bsc_field1": "value1", "bsc_field2": "value2", "bsc_field3": "value3" }) }, ClearCollect( Metadata, TableUtils_1.JsonToTable(jsonData) ) ) ``` -------------------------------- ### Validate URL in Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/regex-functions/README.md This Power Fx function uses a regular expression to validate if a string matches a valid URL pattern. It takes the URL text as input and returns a boolean indicating if it is a valid URL. ```Power Fx IsURL(URLTxt) ``` -------------------------------- ### Validate IPv4 Address Pattern in Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/regex-functions/README.md Indicates whether a string follows a valid IPV4 address pattern. Requires the 'IPv4Txt' parameter, which is the text value to evaluate. Returns a Boolean indicating if the format is valid. ```Power Fx IsIPAddress(IPv4Txt) ``` -------------------------------- ### Validate US Currency Format in Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/regex-functions/README.md Regex to validate currency format (US). Requires the 'CurrencyTxt' parameter, which is the text value to evaluate. Returns a Boolean indicating if the format is valid. ```Power Fx IsCurrency(CurrencyTxt) ``` -------------------------------- ### Validate Email Address Pattern in Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/regex-functions/README.md Indicates whether a string follows a valid email address pattern. Requires the 'EmailTxt' parameter, which is the text value to evaluate. Returns a Boolean indicating if the format is valid. ```Power Fx IsEmail(EmailTxt) ``` -------------------------------- ### Calculating Number of Periods (NPER) in Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/financial-functions/readme.md Calculates the number of periods required for an investment based on a rate (12%), periodic payment (-100), present value (-1000), and future value (10000). ```Power Fx NPER(0.12, -100,-1000, 10000) ``` -------------------------------- ### Linearize sRGB Color Channel (Power Fx) Source: https://github.com/pnp/powerfx-samples/blob/main/samples/color-functions/README.md This Power Fx formula linearizes an sRGB color channel value (R, G, or B) based on a standard formula used in color science. It checks if the normalized channel value is below a threshold (0.03928) and applies a linear or power function accordingly. The input is a single color channel value (0-255), and the output is a linearized number. ```Excel Formula If( Sum(colorChannel / 255) <= 0.03928, Sum(colorChannel / 255) / 12.92, Power( ((Sum(colorChannel / 255) + 0.055) / 1.055), 2.4 ) ) ``` -------------------------------- ### Calculating Future Value (FV) in Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/financial-functions/readme.md Calculates the future value of an investment based on a fixed interest rate (6%), number of periods (10), periodic payment (-200), and present value (-500). ```Power Fx FV(0.06, 10,-200, -500) ``` -------------------------------- ### Validate Credit Card Pattern in Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/regex-functions/README.md Indicates whether a string follows a valid credit card pattern, such Visa, Mastercard, AMEX. Requires the 'CreditCardTxt' parameter, which is the text value to evaluate. Returns a Boolean. ```Power Fx IsCreditCard(CreditCardTxt) ``` -------------------------------- ### Syntax for YearFraction in Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/date-functions/readme.md Calculates the fraction of a year between two dates as a decimal number. It requires a StartDate (DateTime) and an EndDate (DateTime), and optionally accepts a Basis (Number). The function returns a Number. ```Power Fx YearFraction(StartDate, EndDate [,Basis]) ``` -------------------------------- ### Detecting Square-Square Collision in Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/collisiondetection-functions/README.md This snippet demonstrates how to use the `SquareSquare` function to check for collision between two rectangular controls in Power Apps. It passes the X, Y, Width, and Height properties of two rectangles as arguments. ```Power Fx SquareSquare( Rectangle1.X, Rectangle1.Y, Rectangle1.Width, Rectangle1.Height, Rectangle2.X, Rectangle2.Y, Rectangle2.Width, Rectangle2.Height ) ``` -------------------------------- ### Calculating Present Value (PV) with Omitted FV in Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/financial-functions/readme.md Calculates the present value of an investment based on a rate (8%), number of periods (10), and periodic payment (10000). The future value is omitted, defaulting to 0. ```Power Fx PV(0.08, 10, 10000) ``` -------------------------------- ### Validate UK NHS Number Pattern in Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/regex-functions/README.md Indicates whether a string follows a valid UK NHS number pattern. Requires the 'NHSNumberTxt' parameter, which is the text value to evaluate. Returns a Boolean indicating if the format is valid. ```Power Fx IsNHSNumber(NHSNumberTxt) ``` -------------------------------- ### Detecting Square-Circle Collision in Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/collisiondetection-functions/README.md This snippet shows how to use the `SquareCircle` function to detect collision between a rectangular control and a circular control. It takes the X, Y, Width, and Height of the rectangle and the X, Y, and Radius of the circle. ```Power Fx SquareCircle( Rectangle1.X, Rectangle1.Y, Rectangle1.Width, Rectangle1.Height, Circle2.X, Circle2.Y, Circle2.Width / 2 ) ``` -------------------------------- ### Validate UK Driving Licence in Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/regex-functions/README.md This Power Fx function validates whether a string matches a valid UK driving license pattern using a regular expression. It requires the text value to check and returns true if it matches the pattern, false otherwise. ```Power Fx IsUKDrivingLicence(UKDrivingLicenceTxt) ``` -------------------------------- ### Checking if Date is Between Dates using Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/date-functions/readme.md This snippet shows the syntax for the `IsBetweenDates` function in Power Fx. It checks if a given date (`EvaluateDate`) falls within a specified range defined by `StartDate` and `EndDate`. All parameters are required DateTime values. The function returns a Boolean indicating the result. ```excel IsBetweenDates(EvaluateDate, StartDate, EndDate) ``` -------------------------------- ### Calculating Future Value (FV) with Omitted PV in Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/financial-functions/readme.md Calculates the future value of an investment based on a fixed interest rate (12%), number of periods (12), and periodic payment (-1000). The present value is omitted, defaulting to 0. ```Power Fx FV(0.12, 12,-1000) ``` -------------------------------- ### Validate UK Phone Number in Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/regex-functions/README.md This Power Fx function validates whether a string matches a valid UK phone number pattern using a regular expression. It takes the phone number text as input and returns a boolean. ```Power Fx IsUKPhoneNumber(UKPhoneNumberTxt) ``` -------------------------------- ### Checking if Date is in Next N Days using Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/date-functions/readme.md This snippet shows the syntax for the `IsInNextNDays` function in Power Fx. It checks if a date (`EvaluateDate`) falls within the next specified number of days (`NumberOfDays`) from an optional `StartDate` (defaults to today). `EvaluateDate` and `NumberOfDays` are required. The function returns a Boolean result. ```excel IsInNextNDays(EvaluateDate, NumberOfDays [, StartDate]) ``` -------------------------------- ### Validate Time Format in Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/regex-functions/README.md Regex to validate time format [hh:mm:ss]/[hr:min:sec]/[mm:ss]/[m:s]/[ss]/[s]. Requires the 'TimeTxt' parameter, which is the text value to evaluate. Returns a Boolean indicating if the format is valid. ```Power Fx IsTime(TimeTxt) ``` -------------------------------- ### Validate UK Passport in Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/regex-functions/README.md This Power Fx function checks if a string matches a valid UK passport pattern using a regular expression. It requires the text value to validate and outputs a boolean. ```Power Fx IsUKPassport(UKPassportTxt) ``` -------------------------------- ### Checking if Date is in Current Day using Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/date-functions/readme.md This snippet shows the syntax for the `IsInCurrentDay` function in Power Fx. It checks if the specified date (`EvaluateDate`) is today's date. The `EvaluateDate` parameter is required and must be a DateTime value. The function returns a Boolean result. ```excel IsInCurrentDay(EvaluateDate) ``` -------------------------------- ### Checking if Date is in Next N Quarters using Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/date-functions/readme.md This snippet shows the syntax for the `IsInNextNQuarters` function in Power Fx. It checks if a date (`EvaluateDate`) falls within the next specified number of quarters (`NumberOfQuarters`) from an optional `StartDate` (defaults to today). `EvaluateDate` and `NumberOfQuarters` are required. The function returns a Boolean result. ```excel IsInNextNQuarters(EvaluateDate, NumberOfQuarters [, StartDate]) ``` -------------------------------- ### Checking if Date is in Next N Months using Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/date-functions/readme.md This snippet shows the syntax for the `IsInNextNMonths` function in Power Fx. It checks if a date (`EvaluateDate`) falls within the next specified number of months (`NumberOfMonths`) from an optional `StartDate` (defaults to today). `EvaluateDate` and `NumberOfMonths` are required. The function returns a Boolean result. ```excel IsInNextNMonths(EvaluateDate, NumberOfMonths [, StartDate]) ``` -------------------------------- ### Validate US Phone Number in Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/regex-functions/README.md This Power Fx function validates whether a string matches a valid US phone number pattern using a regular expression. It takes the phone number text as input and returns a boolean. ```Power Fx IsUSPhoneNumber(USPhoneNumberTxt) ``` -------------------------------- ### Checking if Date is in Next N Weeks using Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/date-functions/readme.md This snippet shows the syntax for the `IsInNextNWeeks` function in Power Fx. It checks if a date (`EvaluateDate`) falls within the next specified number of weeks (`NumberOfWeeks`) from an optional `StartDate` (defaults to today). `EvaluateDate` and `NumberOfWeeks` are required. The function returns a Boolean result. ```excel IsInNextNWeeks(EvaluateDate, NumberOfWeeks [, StartDate]) ``` -------------------------------- ### Validate UK National Insurance Number in Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/regex-functions/README.md This Power Fx function uses a regular expression to validate if a string matches a valid UK National Insurance Number pattern. It takes the text input and returns a boolean indicating the validation result. ```Power Fx IsUKNationalInsuranceNumber(UKNINumberTxt) ``` -------------------------------- ### Validate Canadian Phone Number in Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/regex-functions/README.md Indicates whether a string follows a valid Canadian phone number pattern. Requires the 'CanadianPhoneNumberTxt' parameter, which is the text value to evaluate. Returns a Boolean indicating if the format is valid. ```Power Fx IsCanadaPhoneNumber(CanadianPhoneNumberTxt) ``` -------------------------------- ### Checking if Date is in Current Quarter using Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/date-functions/readme.md This snippet shows the syntax for the `IsInCurrentQuarter` function in Power Fx. It checks if the specified date (`EvaluateDate`) falls within the current quarter. The `EvaluateDate` parameter is required and must be a DateTime value. The function returns a Boolean result. ```excel IsInCurrentQuarter(EvaluateDate) ``` -------------------------------- ### Checking if Date is in Current Month using Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/date-functions/readme.md This snippet shows the syntax for the `IsInCurrentMonth` function in Power Fx. It checks if the specified date (`EvaluateDate`) falls within the current month. The `EvaluateDate` parameter is required and must be a DateTime value. The function returns a Boolean result. ```excel IsInCurrentMonth(EvaluateDate) ``` -------------------------------- ### Checking if Date is in Current Year using Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/date-functions/readme.md This snippet shows the syntax for the `IsInCurrentYear` function in Power Fx. It checks if the specified date (`EvaluateDate`) falls within the current year. The `EvaluateDate` parameter is required and must be a DateTime value. The function returns a Boolean result. ```excel IsInCurrentYear(EvaluateDate) ``` -------------------------------- ### Validate US Social Security Number in Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/regex-functions/README.md This Power Fx function uses a regular expression to validate if a string matches a valid US Social Security number pattern. It requires the text value to check and returns a boolean. ```Power Fx IsUSSocialSecurityNumber(USSNTxt) ``` -------------------------------- ### Checking if Date is Leap Year using Power Fx Source: https://github.com/pnp/powerfx-samples/blob/main/samples/date-functions/readme.md This snippet shows the syntax for the `IsLeapYear` function in Power Fx. It determines if the provided date (`EvaluateDate`) falls within a leap year. The `EvaluateDate` parameter is required and must be a DateTime value. The function returns a Boolean result. ```excel IsLeapYear(EvaluateDate) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.