A
C
- CALCULATE
- CALCULATETABLE
- CALENDAR
- CALENDARAUTO
- CEILING
- CHISQ.DIST
- CHISQ.DIST.RT
- CHISQ.INV
- CHISQ.INV.RT
- CLOSINGBALANCEMONTH
- CLOSINGBALANCEQUARTER
- CLOSINGBALANCEYEAR
- COALESCE
- COLUMNSTATISTICS
- COMBIN
- COMBINA
- COMBINEVALUES
- CONCATENATE
- CONCATENATEX
- CONFIDENCE.NORM
- CONFIDENCE.T
- CONTAINS
- CONTAINSROW
- CONTAINSSTRING
- CONTAINSSTRINGEXACT
- CONVERT
- COS
- COSH
- COT
- COTH
- COUNT
- COUNTA
- COUNTAX
- COUNTBLANK
- COUNTROWS
- COUNTX
- COUPDAYBS
- COUPDAYS
- COUPDAYSNC
- COUPNCD
- COUPNUM
- COUPPCD
- CROSSFILTER
- CROSSJOIN
- CUMIPMT
- CUMPRINC
- CURRENCY
- CURRENTGROUP
- CUSTOMDATA
D
E
I
N
O
P
R
S
- SAMEPERIODLASTYEAR
- SAMPLE
- SEARCH
- SECOND
- SELECTCOLUMNS
- SELECTEDMEASURE
- SELECTEDMEASUREFORMATSTRING
- SELECTEDMEASURENAME
- SELECTEDVALUE
- SIGN
- SIN
- SINH
- SLN
- SQRT
- SQRTPI
- STARTOFMONTH
- STARTOFQUARTER
- STARTOFYEAR
- STDEVX.P
- STDEVX.S
- STDEV.P
- STDEV.S
- SUBSTITUTE
- SUBSTITUTEWITHINDEX
- SUM
- SUMMARIZE
- SUMMARIZECOLUMNS
- SUMX
- SWITCH
- SYD
T
U
What is SAMPLE function in DAX?
The SAMPLE function is a DAX function that is used to return a random sample of data from a table or column in Power BI. The syntax for the SAMPLE function is as follows:
SAMPLE ( ❰table❱, ❰size❱ [, ❰seed❱] )
The first argument of the SAMPLE function is the table or column from which the sample is to be selected. The second argument is the size of the sample, which is specified as a percentage of the total number of rows in the table or column. The third argument (optional) is the seed value for the random number generator used by the SAMPLE function.
How to use SAMPLE function in Power BI
Using the SAMPLE function in Power BI is straightforward. Here are the steps:
1. Open Power BI Desktop and load the dataset that you want to analyze.
2. Select the table or column from which you want to select a sample.
3. Click on the "New Measure" button in the "Modeling" tab of the ribbon.
4. In the "Formula Bar", type the following formula:
Sampled Data = SAMPLE ( ❰table❱, ❰size❱ [, ❰seed❱] )
5. Replace `❰table❱` with the name of the table or column from which you want to select a sample.
6. Replace `❰size❱` with the desired size of the sample, specified as a percentage (e.g., 10%).
7. (Optional) Replace `❰seed❱` with a seed value for the random number generator used by the SAMPLE function.
8. Click on "Enter" to create the new measure.
Once the measure is created, you can use it in your visualizations and analysis just like any other measure.
Why use SAMPLE function in Power BI
The SAMPLE function is useful in many situations where you want to analyze a large dataset but don't need to see all the data at once. For example, if you have a dataset with millions of rows, it may be impractical to load and visualize all the data at once. In this case, you can use the SAMPLE function to select a smaller random sample of the data and visualize it instead. This can save time and resources and make your analysis more manageable.
Another use case for the SAMPLE function is when you want to test a hypothesis or validate a model using a representative sample of the data. By selecting a random sample of the data, you can reduce the risk of bias and ensure that your analysis is based on a representative subset of the data.
The SAMPLE function is a powerful DAX function that can help you analyze and visualize large datasets in Power BI. By selecting a random sample of the data, you can save time and resources and make your analysis more manageable. The SAMPLE function is easy to use and can be customized to suit your needs. If you haven't already tried using the SAMPLE function in Power BI, give it a try and see how it can help you gain insights from your data.