March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi there,
I have a matrix which shows monthly cost, YTD cost, last year YTD cost, YTD budget etc. The cost data is pulled from the transactions table & budget info from the budget table. I have a filter set up on the matrix for "in the last 1 calendar month" as i want to report on the previous month. I then have cards above the matrix with one being the full year budget.
The issue i have here is when i click a certain cost category on the matrix (e.g. wages) i want the full year budget card to filter on this category but not on the last calendar month but can't work out how to do this. At present when i click on the matrix the fy budget card changes to the last calendar months value for the specific category i select. So essentailly i want the FY budget card to stay filtered on period 12 (as the budget table values are running balances each month) but want it filtered by the matrix category i select.
Is there an easy way of doing this?
Thanks
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.
Hello @V0strox337,
1. Create a DAX Measure for FY Budget by Category
FY Budget by Category =
CALCULATE(
SUM(BudgetTable[BudgetAmount]),
FILTER(BudgetTable, BudgetTable[Category] = SELECTEDVALUE(Matrix[Category])),
FILTER(BudgetTable, BudgetTable[Period] = 12) // Assuming 12 is the fiscal year end
)
2. Create a DAX Measure for Last Calendar Month
Last Calendar Month Cost =
CALCULATE(
SUM(TransactionsTable[Cost]),
FILTER(TransactionsTable, TransactionsTable[Date] >= STARTOFMONTH(TODAY()) - 1 && TransactionsTable[Date] <= ENDOFMONTH(TODAY()) - 1)
)
3. Create a Card Visualization for FY Budget: This card should display the budget for the selected category while the period remains fixed at 12
4. Create a Card Visualization for Last Calendar Month
Should you require further details or information, please do not hesitate to reach out to me.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
23 | |
16 | |
12 | |
9 | |
7 |
User | Count |
---|---|
38 | |
32 | |
28 | |
12 | |
11 |