📅  最后修改于: 2023-12-03 15:03:50.869000             🧑  作者: Mango
Power BI is a powerful tool for data analysis and visualization. The Sum function is a commonly used function in Power BI. It allows you to sum up a column of values in a table. However, what if you only want to sum up a certain subset of values in the column? This is where the filter function comes in.
The Filter function in Power BI allows you to create a subset of data from a larger table. It does this by evaluating a certain condition and returning only the rows that meet that condition. Let's take a look at an example:
FilteredTable = FILTER(Table, Table[Column] >= 10)
In this example, we create a new table called FilteredTable by using the Filter function. The condition we evaluate is that the values in the Column column of the Table must be greater than or equal to 10. The Filter function then returns a new table that only contains the rows that meet this condition.
Now that we know what the Filter function does, we can use it in combination with the Sum function to sum up a certain subset of values in a column. Here's an example:
TotalSales = SUM(FILTER(Sales, Sales[Region] = "West"))
In this example, we create a new measure called TotalSales by using the SUM function. The subset of data we want to sum up is defined by the FILTER function, which only includes rows where the Region column is equal to "West". The SUM function then sums up the values in the Sales column of this subset of data.
The Filter function is a powerful tool in Power BI that allows you to create a subset of data from a table. When used in combination with the Sum function, it allows you to sum up a certain subset of values in a column. This can be useful when you only want to analyze a certain portion of your data.