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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
robbielambert
Frequent Visitor

Complex table filter within a measure

Hi,

 

I have two tables identical in design to the examples in the image the below. Table 1 contains ~100K rows, table 2 contains ~500K rows. 

 

I am looking to build measures which would allow me to report on Transaction Amount by Transaction Date (from table 2) for a given Category from table 1. I need 1 measure which reports the amount on the Transaction Date, and another which reports the amount cumulatively up to that Transaction Date.

 

There are only 3 categories, so I am happy to have a measure for each category (i.e.  Category A Transaction Amount andCategory A Transaction Amount Cumulative), rather than have the category as a dimension.

 

I think the logic to build the measures for Category A should be:

 

1. Chose a date from the transactions table

2. Filter the categories table for rows where the from date is less or equal to the transaction date and the To Date is greater than the transaction date and Category = A

3. Sum all values in the transactions table for the sub set of customers generated by part 2 (either cumulatively to that date, or specifically for that date).

 

Unfortunately, I am failing miserably at step 2. ANy help would be incredibly gratefully recieved.

 

Thanks 

 

Tables.PNG

 

 
2 REPLIES 2
Pragati11
Super User
Super User

Hi @robbielambert ,

 

Have you tried creating relationship between these 2 tables on "Customer" and then try performing the 3 steps?

Also, can you share the DAX or calculation you are using for the 3 steps you mentioned?

 

If this helps and resolves the issue, appreciate a Kudos and mark it as a Solution! 🙂

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Hi @Pragati11,

 

Thanks for getting in touch. 

 

I have a join on customer between the two tables as you describe. It is then the step of defining which customers are in a specific category on a given date that is where i am failing.

 

The approach I have taken is to create a table variable which filters for the accounts in a specifc category on a specific date, and then try to filter the transactions table using the list I have created. However, I cannot seem to restrict the transactions table by the table variable I have created. I'm sure there must be an easier way!!

 

Here is my DAX:

 

Transactions Amount =

VAR VarTable = CALCULATETABLE('Categories','Categories'[From Date] <= EOMONTH(today(),-2), 'Categories'[To Date] > EOMONTH(today(),-2),'Categories'[category] = "A")

RETURN

CALCULATE(SUMX(CALCULATETABLE('Transactions',EXCEPT(VALUES('Transactions'[Customer]), VALUES(I want to reference VarTable here))),'Transactions'[Amount]))
 
Thanks

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.