PowerApps 的公式參考Formula reference for PowerApps

公式結合許多元素。Formulas combine many elements. 列示如下︰Listed below are:

  • 函數會接受參數、執行運算,然後傳回值。Functions take parameters, perform an operation, and return a value. 例如,Sqrt(25) 會傳回 5For example, Sqrt(25) returns 5. 函式是依 Microsoft Excel 函式而建立。Functions are modeled after Microsoft Excel functions. 有些函式有副作用,例如SubmitForm 只適用於行為公式 (如 Button.OnSelect)。Some functions have side effects, such as SubmitForm, which are appropriate only in a behavior formula such as Button.OnSelect.
  • 訊號會傳回環境的相關資訊。Signals return information about the environment. 例如,Location 會傳回裝置目前的 GPS 座標。For example, Location returns the device's current GPS coordinates. 訊號不接受參數,沒有副作用。Signals don't take parameters or have side effects.
  • 列舉會傳回預先定義的常數值。Enumerations return a pre-defined constant value. 例如,Color 是已預先定義 Color.RedColor.Blue 等值的列舉。For example, Color is an enumeration that has pre-defined values for Color.Red, Color.Blue, and so forth. 以下也列出常見的列舉;特定函式的列舉會和該函式一同說明。Common enumerations are included here; function-specific enumerations are described with the function.
  • 具名運算子,例如 ThisItemParent,可從容器內存取資訊。Named operators, such as ThisItem and Parent, provide access to information from within a container.

其他元素還包括︰Other elements include:


Abs – 數字的絕對值。Abs – Absolute value of a number.

Acceleration – 讀取裝置中的加速感應器。Acceleration – Reads the acceleration sensor in your device.

Acos – 傳回數字的反餘弦值,單位為弧度。Acos – Returns the arccosine of a number, in radians.

Acot – 傳回數字的反餘切值,單位為弧度。Acot – Returns the arccotangent of a number, in radians.

AddColumns – 傳回資料表,且其中加入資料行AddColumns – Returns a table with columns added.

And – 布林邏輯 AND。And – Boolean logic AND. 如果所有引數皆為 true,則傳回 trueReturns true if all arguments are true. 您也可以使用 && 運算子You can also use the && operator.

App – 傳回目前執行中應用程式的相關資訊,例如其目前顯示的畫面。App – Returns information about the currently running app, such as which screen is currently displayed.

Asin – 傳回數字的反正弦值,單位為弧度。Asin – Returns the arcsine of a number, in radians.

Atan – 傳回數字的反正切值,單位為弧度。Atan – Returns the arctangent of a number, in radians.

Atan2 – 依據 (x,y) 座標傳回反正切值,單位為弧度。Atan2 – Returns the arctangent based on an (x,y) coordinate, in radians.

Average – 計算資料表運算式或一組引數的平均值。Average – Calculates the average of a table expression or a set of arguments.


Back – 顯示前一個畫面。Back – Displays the previous screen.

Blank – 傳回「空白」值,以用來在資料來源中插入 NULL 值。Blank – Returns a blank value that can be used to insert a NULL value in a data source.


Calendar – 擷取目前地區設定的行事曆相關資訊。Calendar – Retrieves information about the calendar for the current locale.

Char – 將字元碼轉譯成字串。Char – Translates a character code into a string.

Clear – 刪除集合中的所有資料。Clear – Deletes all data from a collection.

ClearCollect – 刪除集合中的所有資料,然後加入一組記錄ClearCollect – Deletes all data from a collection and then adds a set of records.

Clock – 擷取目前地區設定的時鐘相關資訊。Clock – Retrieves information about the clock for the current locale.

聯合 – 取代空白值,同時讓非空白值保持不變。Coalesce – Replaces blank values while leaving non-blank values unchanged.

Collect – 建立集合,或將資料加入資料來源。Collect – Creates a collection or adds data to a data source.

Color – 將屬性設定為內建的色彩值。Color – Sets a property to a built-in color value.

ColorFade – 淡出色彩值。ColorFade – Fades a color value.

ColorValue – 將 CSS 色彩名稱或十六進位碼轉譯為色彩值。ColorValue – Translates a CSS color name or a hex code to a color value.

Compass – 傳回羅盤的標題。Compass – Returns your compass heading.

Concat – 串連資料來源中的字串。Concat – Concatenates strings in a data source.

Concatenate – 串連字串。Concatenate – Concatenates strings.

Connection – 傳回網路連線的相關資訊。Connection – Returns information about your network connection.

Count – 計算包含數字的資料表記錄。Count – Counts table records that contain numbers.

Cos – 傳回以弧度指定之角度的餘弦值。Cos – Returns the cosine of an angle specified in radians.

Cot – 傳回以弧度指定之角度的餘切值。Cot – Returns the cotangent of an angle specified in radians.

CountA – 計算非空白的資料表記錄。CountA – Counts table records that aren't empty.

CountIf – 計算符合條件的資料表記錄。CountIf – Counts table records that satisfy a condition.

CountRows – 計算資料表記錄。CountRows – Counts table records.


DataSourceInfo – 提供資料來源的相關資訊。DataSourceInfo – Provides information about a data source.

Date – 根據的值傳回日期/時間值。Date – Returns a date/time value, based on Year, Month, and Day values.

DateAdd – 將日、月、季或年加入日期/時間值。DateAdd – Adds days, months, quarters, or years to a date/time value.

DateDiff – 將兩個日期值相減,並以天、月、季或年顯示結果。DateDiff – Subtracts two date values, and shows the result in days, months, quarters, or years.

DateTimeValue – 將日期和時間字串轉換成日期/時間值。DateTimeValue – Converts a date and time string to a date/time value.

DateValue – 將僅有日期的字串轉換成日期/時間值。DateValue – Converts a date-only string to a date/time value.

Day – 擷取日期/時間值的日期部份。Day – Retrieves the day portion of a date/time value.

Defaults – 傳回資料來源的預設值。Defaults – Returns the default values for a data source.

Degrees – 將弧度轉換成角度。Degrees - Converts radians to degrees.

Disable – 停用信號,例如用於讀取 GPS 的 LocationDisable – Disables a signal, such as Location for reading the GPS.

Distinct – 摘要資料表的記錄,移除重複項目。Distinct – Summarizes records of a table, removing duplicates.

Download – 從網路下載檔案到本機裝置。Download – Downloads a file from the web to the local device.

DropColumns – 傳回資料表,且其中移除一或多個資料行。DropColumns – Returns a table with one or more columns removed.


EditForm – 重設表單中用於編輯項目的控制項。EditForm – Resets a form control for editing of an item.

Enable – 啟用信號,例如用於讀取 GPS 的 LocationEnable – Enables a signal, such as Location for reading the GPS.

EndsWith – 檢查文字字串的結尾是否為另一個文字字串。EndsWith – Checks whether a text string ends with another text string.

Errors – 提供先前變更資料來源的錯誤資訊。Errors – Provides error information for previous changes to a data source.

EncodeUrl – 使用 URL 編碼將特殊字元編碼。EncodeUrl – Encodes special characters using URL encoding.

Exit – 結束目前正在執行的應用程式。Exit – Exits the currently running app.

Exp – 傳回 e 的次方。Exp - Returns e raised to a power.


Filter – 傳回依一或多個準則篩選過的資料表。Filter – Returns a filtered table based on one or more criteria.

Find – 檢查字串是否出現在另一個字串中,並傳回其位置。Find – Checks whether one string appears within another and returns the location.

First – 傳回資料表的第一筆記錄。First – Returns the first record of a table.

FirstN – 傳回資料表的第一組記錄 (N 筆記錄)。FirstN – Returns the first set of records (N records) of a table.

ForAll – 計算值,並對資料表的所有記錄執行動作。ForAll – Calculates values and performs actions for all records of a table.


GroupBy – 傳回記錄已群組的資料表。GroupBy – Returns a table with records grouped together.


HashTags – 從字串中擷取主題標籤 (#strings)。HashTags – Extracts the hashtags (#strings) from a string.

Hour – 擷取日期/時間值的小時部份。Hour – Returns the hour portion of a date/time value.


If – 如果條件成立則傳回一個值,不成立則傳回另一個值。If – Returns one value if a condition is true and another value if not.

IsBlank – 檢查空白值。IsBlank – Checks for a blank value.

IsEmpty – 檢查空資料表。IsEmpty – Checks for an empty table.

IsMatch – 檢查字串的模式。IsMatch – Checks a string against a pattern. 可以使用規則運算式。Regular expressions can be used.

IsNumeric – 檢查數值。IsNumeric – Checks for a numeric value.

IsToday – 檢查日期/時間值是否為今天的某個時間。IsToday – Checks whether a date/time value is sometime today.


Language – 傳回目前使用者慣用語言的語言標記。Language – Returns the language tag of the current user.

Last – 傳回資料表的最後一筆記錄。Last – Returns the last record of a table.

LastN – 傳回資料表的最後一組記錄 (N 筆記錄)。LastN – Returns the last set of records (N records) of a table.

Launch – 啟動網址或應用程式。Launch – Launches a web address or an app.

Left – 傳回字串最左邊的部分。Left – Returns the left-most portion of a string.

Len – 傳回字串的長度。Len – Returns the length of a string.

Ln – 傳回自然對數。Ln – Returns the natural log.

LoadData – 從 PowerApps 私人儲存體載入集合。LoadData – Loads a collection from PowerApps private storage.

Location – 使用全球定位系統 (GPS) 和其他資訊,傳回您的位置當作地圖座標。Location – Returns your location as a map coordinate by using the Global Positioning System (GPS) and other information.

LookUp – 依據一個或多個準則,查閱資料表中的單一記錄。LookUp – Looks up a single record in a table based on one or more criteria.

Lower – 將文字字串中的字母全部轉換為小寫。Lower – Converts letters in a string of text to all lowercase.


Max – 計算資料表運算式或一組引數的最大值。Max – Maximum value of a table expression or a set of arguments.

Mid – 傳回字串最中間的部分。Mid – Returns the middle portion of a string.

Min – 計算資料表運算式或一組引數的最小值。Min – Minimum value of a table expression or a set of arguments.

Minute – 擷取日期/時間值的分鐘部份。Minute – Retrieves the minute portion of a date/time value.

Mod – 傳回被除數除以除數後的餘數。Mod – Returns the remainder after a dividend is divided by a divisor.

Month – 擷取日期/時間值的月份部份。Month – Retrieves the month portion of a date/time value.


Navigate – 變更顯示的畫面。Navigate – Changes which screen is displayed.

NewForm – 重設表單中用於編輯項目的控制項。NewForm – Resets a form control for creation of an item.

Not – 布林邏輯 NOT。Not – Boolean logic NOT. 如果其引數為 false 則傳回 true,如果其引數為 true 則傳回 falseReturns true if its argument is false, and returns false if its argument is true. 您也可以使用 ! 運算子You can also use the ! operator.

Now – 傳回目前的日期/時間值。Now – Returns the current date/time value.


Or – 布林邏輯 OR。Or – Boolean logic OR. 如果其任一引數為 true,則傳回 trueReturns true if any of its arguments are true. 您也可以使用 || 運算子You can also use the || operator.


Param – 可存取當使用者開啟應用程式時傳遞至應用程式的參數。Param – Provides access to parameters passed to the app when the user opened it.

Parent – 可存取容器控制項的屬性。Parent – Provides access to a container control's properties.

Patch – 修改或建立資料來源中的記錄,或合併資料來源外的記錄。Patch – Modifies or creates a record in a data source, or merges records outside of a data source.

Pi – 傳回數字 π。Pi – Returns the number π.

PlainText – 移除字串中的 HTML 和 XML 標記。PlainText – Removes HTML and XML tags from a string.

Power – 傳回數字的次方。Power – Returns a number raised to a power. 您也可以使用 ^ 運算子You can also use the ^ operator.

Proper – 將字串中每個單字的第一個字母轉換為大寫,並將其餘部分轉換成小寫。Proper – Converts the first letter of each word in a string to uppercase, and converts the rest to lowercase.


Radians - 將角度轉換為弧度。Radians - Converts degrees to radians.

Rand – 傳回虛擬亂數。Rand – Returns a pseudo-random number.

Refresh – 重新整理資料來源的記錄。Refresh – Refreshes the records of a data source.

Remove – 從資料來源中移除一或多個特定記錄。Remove – Removes one or more specific records from a data source.

RemoveIf – 根據條件移除資料來源中的記錄。RemoveIf – Removes records from a data source based on a condition.

RenameColumns – 重新命名資料表的資料行。RenameColumns – Renames columns of a table.

取代 – 以另一個字串取代字串的一部分,從字串的起始位置開始。Replace – Replaces part of a string with another string, by starting position of the string.

Reset – 將輸入控制項重設為預設值,並捨棄所有使用者的變更。Reset – Resets an input control to its default value, discarding any user changes.

ResetForm – 重設表單中用於編輯現有項目的控制項。ResetForm – Resets a form control for editing of an existing item.

Revert – 重新載入資料來源的記錄,並清除其錯誤。Revert – Reloads and clears errors for the records of a data source.

RGBA – 傳回一組紅色、綠色、藍色及 alpha 元件的色彩值。RGBA – Returns a color value for a set of red, green, blue, and alpha components.

Right – 傳回字串最右邊的部分。Right – Returns the right-most portion of a string.

Round – 四捨五入至最接近的數字。Round – Rounds to the closest number.

RoundDown – 四捨五入至最大的上一個數字。RoundDown – Rounds down to the largest previous number.

RoundUp – 四捨五入至最小的下一個數字。RoundUp – Rounds up to the smallest next number.


SaveData – 將集合儲存至 PowerApps 私人儲存體。SaveData – Saves a collection to PowerApps private storage.

Search – 尋找資料表中其資料行之一包含字串的記錄。Search – Finds records in a table that contain a string in one of their columns.

Second – 擷取日期/時間值的秒數部份。Second – Retrieves the second portion of a date/time value.

Set – 設定全域變數的值。Set – Sets the value of a global variable.

ShowColumns – 傳回僅含選取資料行的資料表。ShowColumns – Returns a table with only selected columns.

Shuffle – 隨機重新排列資料表的記錄。Shuffle – Randomly reorders the records of a table.

Sin – 傳回以弧度指定之角度的正弦值。Sin – Returns the sine of an angle specified in radians.

Sort – 傳回依據公式排序的資料表。Sort – Returns a sorted table based on a formula.

SortByColumns – 傳回依據一或多個資料行排序的資料表。SortByColumns – Returns a sorted table based on one or more columns.

Split – 將文字字串分割成許多子字串。Split – Splits a text string into a table of substrings.

Sqrt – 傳回數字的平方根。Sqrt – Returns the square root of a number.

StartsWith – 檢查文字字串的開頭是否為另一個文字字串。StartsWith – Checks if a text string begins with another text string.

StdevP – 傳回其引數的標準差。StdevP – Returns the standard deviation of its arguments.

Substitute – 以另一個字串取代字串的一部分,從相符處開始。Substitute – Replaces part of a string with another string, by matching strings.

SubmitForm – 將項目儲存在資料來源的表單控制項中。SubmitForm – Saves the item in a form control to the data source.

Sum – 計算資料表運算式或一組引數的總和。Sum – Calculates the sum of a table expression or a set of arguments.

Switch – 與一組值進行比對,然後評估對應的公式。Switch – Matches with a set of values and then evaluates a corresponding formula.


Table – 建立暫存資料表。Table – Creates a temporary table.

Tan – 傳回以弧度指定之角度的正切值。Tan - Returns the tangent of an angle specified in radians.

Text – 將數字格式化字串以便顯示。Text – Formats a number as a string for display.

ThisItem – 當在資源庫或表單中,會從容器傳回目前項目的資料。ThisItem – When in a gallery or form, returns the data for the current item from the container.

Time – 根據的值傳回日期/時間值。Time – Returns a date/time value, based on Hour, Minute, and Second values.

TimeValue – 將僅有時間的字串轉換成日期/時間值。TimeValue – Converts a time-only string to a date/time value.

TimeZoneOffset – 傳回 UTC 與使用者當地時間之間的差異,以分鐘為單位。TimeZoneOffset – Returns the difference between UTC and the user's local time in minutes.

Today – 傳回目前的日期/時間值。Today – Returns the current date/time value.

Trim – 將文字字串內和結尾的多餘空格移除。Trim – Removes extra spaces from the ends and interior of a string of text.

TrimEnds – 僅將文字字串結尾的多餘空格移除。TrimEnds – Removes extra spaces from the ends of a string of text only.


Ungroup – 移除群組。Ungroup – Removes a grouping.

Update – 取代資料來源中的記錄。Update – Replaces a record in a data source.

UpdateContext – 設定目前畫面中的一個或多個內容變數值。UpdateContext – Sets the value of one or more context variables of the current screen.

UpdateIf – 根據條件修改資料來源中的一組記錄。UpdateIf – Modifies a set of records in a data source based on a condition.

Upper – 將文字字串中的字母全部轉換為大寫。Upper – Converts letters in a string of text to all uppercase.

User – 傳回目前使用者的相關資訊。User – Returns information about the current user.


Validate – 檢查單一資料行或完整記錄的值是否為有效的資料來源。Validate – Checks whether the value of a single column or a complete record is valid for a data source.

Value – 將字串轉換為數字。Value – Converts a string to a number.

VarP – 傳回其引數的變異數。VarP – Returns the variance of its arguments.

ViewForm – 重設用於檢視現有項目的表單控制項。ViewForm – Resets a form control for viewing of an existing item.


Weekday – 擷取日期/時間值的星期幾部份。Weekday – Retrieves the weekday portion of a date/time value.


Year – 擷取日期/時間值的年份部份。Year – Retrieves the year portion of a date/time value.