Forum Discussion
Card filtering from matrix
To achieve the desired behavior of having a card display the full-year (FY) budget for a specific category while keeping the period fixed at 12 (for the full year), you can use a combination of measures and filter context manipulation in Power BI. Here's a step-by-step approach to do this:
1. Create a Measure for FY Budget:
- Create a measure that calculates the FY budget for the selected category. This measure should filter the budget data based on the selected category and period 12 (full year). For example:
DAX Measure
FY Budget = CALCULATE(SUM(BudgetTable[Budget]), BudgetTable[Category] = SELECTEDVALUE(Matrix[Category]), BudgetTable[Period] = 12)
2. Create a Measure for Last Month Cost:
- You mentioned that you have a filter for "in the last 1 calendar month." To calculate the cost for the last calendar month, create a measure that considers this filter. For example:
Dax Measure
Last Month Cost = CALCULATE(SUM(TransactionTable[Cost]), FILTER(TransactionTable, DateTable[InLastMonth] = TRUE()))
In this measure, `DateTable[InLastMonth]` is a placeholder for the logic that identifies whether a transaction is in the last calendar month.
3. Create a Measure for Selected Category Cost:
- Create a measure to calculate the cost for the selected category. This measure should consider the filter context set by the matrix visual. For example:
DAX Measure
Selected Category Cost = CALCULATE(SUM(TransactionTable[Cost]), FILTER(TransactionTable, TransactionTable[Category] = SELECTEDVALUE(Matrix[Category])))
4. Configure the Card Visual for FY Budget:
- In your card visual for FY budget, use the "FY Budget" measure you created in step 1. This card should always show the FY budget for the selected category, regardless of the matrix filter.
5. Configure the Matrix Visual:
- Make sure your matrix visual is using the "Last 1 Calendar Month" filter for its data. This filter will control the data displayed in the matrix.
6. Testing:
- Test your report by selecting different categories in the matrix. The FY budget card should remain fixed at the full-year budget for the selected category, and the matrix should update based on the selected category and the last calendar month.
By creating specific measures for FY budget, last month cost, and selected category cost, you can control the filter context for each visual independently, achieving the desired behavior in your report.