Skip to main content
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

New Member

Card filtering from matrix

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?



Community Champion
Community Champion


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.

Super User
Super User

Hello @V0strox337,


1. Create a DAX Measure for FY Budget by Category

FY Budget by Category = 
    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 = 
    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.

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution?
➤ Lets connect on LinkedIn: Join my network of 13K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website:
➤ Email:
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views):
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Helpful resources

Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors