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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Filtered Count Including Previous Transactions but Excluding Future Transactions

The goal is to count transactions that were previously done but exclude any for the future. Ex: Count all transactions that happened in January 2023 but for February 2023 (and beyond), only Pizza transactions. I was successful in creating a filter that will only count Pizza transactions but I am confused on how I can get the January 2023 Sushi transaction to be counted (excluding Sushi February 2023 transactions and beyond). Below you will find sample data and expected output for context. 

 

Your support is greatly appreciated. 

 

Sample DAX Measure: I am aware that this filters out all Sushi transactions but confused on how to include just January 2023 and exclude any after

 

 

CALCULATE(
    COUNT( trans_id )
    ,FILTER(
        transactions
        ,transactions.product_code <> '200'
    )
)

 

 

 

Sample Data

trans_id product_code product date
1 100 Cheese Pizza 1-Jan-23
2 100 Cheese Pizza 2-Jan-23
3 200 Sushi 2-Jan-23
4 300 Pineapple Pizza 30-Jan-23
5 200 Sushi 3-Feb-23
6 100 Cheese Pizza 9-Feb-23
7 200 Sushi 20-Feb-23
8 300 Pineapple Pizza 22-Feb-23
9 300 Pineapple Pizza 25-Feb-23
10 200 Sushi 28-Feb-23

Expected Output: Notice that January 2023 Sushi transaction was counted but excluded from February 2023

product_code product month_year transaction_count
100 Cheese Pizza Jan-23 2
200 Sushi Jan-23 1
300 Pineapple Pizza Jan-23 1
100 Cheese Pizza Feb-23 1
300 Pineapple Pizza Feb-23 2

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@parry2k thank you so much for your support but I was able to rework some other measures and filters within my project to provide the expected output. Regarding your question, for this specific example...yes this logic is only applying towards "Sushi". But my true application will be filtering a few dozen more items. 

View solution in original post

3 REPLIES 3
parry2k
Super User
Super User

@Anonymous You marked this post as solved, I guess you already have the solution, correct? From your last reply, it was not clear if you need further help or if you are good to go. 🤷‍♂️



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@Anonymous one thing is not clear, is this logic only applied to sushi?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k thank you so much for your support but I was able to rework some other measures and filters within my project to provide the expected output. Regarding your question, for this specific example...yes this logic is only applying towards "Sushi". But my true application will be filtering a few dozen more items. 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.