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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
sanderson82
Helper I
Helper I

Filter measure multiple tables and columns

Hi, read a few posts on this but can't find exactly what I need.  I'm creating a measure which will be used in another calculation.  The inital measure I am creating needs to be filtered based on values in other tables.

 

Below is my measure working with a couple of filters

 

TotalTransport = CALCULATE(
SUM(PCProjectEntry[GoodsAmountInBaseCurrency]),
FILTER(PCProjectEntryDescriptor,PCProjectEntryDescriptor[Name]="Purchase Invoice"),
FILTER(PCProjectItem,PCProjectItem[Code]="Transport")
 
I also want filter by PCProjectEntryDescriptor[Name]="Purchase Credit" and in addtion filter by more than one PCProjectItem[Code].
 
Is it possible to have mulitple filters in one line? eg PCProjectEntryDescriptor[Name]="Purchase Invoice" && "Purchase Credit".....something like that, or does each item require a filter statement regardless if it's in the same table or not?
 
Many thanks
1 ACCEPTED SOLUTION
TeigeGao
Solution Sage
Solution Sage

Hi @sanderson82 ,

In your scenario, we can use the RELATED() funtion and && to write the DAX query:

TotalTransport = CALCULATE(
SUM(PCProjectEntry[GoodsAmountInBaseCurrency]),
FILTER(PCProjectEntryDescriptor,PCProjectEntryDescriptor[Name]="Purchase Invoice"),
FILTER(PCProjectItem,PCProjectItem[Code]="Transport" && RELATED(PCProjectEntryDescriptor[Name])="Purchase Invoice")

Best Regards,

Teige

View solution in original post

1 REPLY 1
TeigeGao
Solution Sage
Solution Sage

Hi @sanderson82 ,

In your scenario, we can use the RELATED() funtion and && to write the DAX query:

TotalTransport = CALCULATE(
SUM(PCProjectEntry[GoodsAmountInBaseCurrency]),
FILTER(PCProjectEntryDescriptor,PCProjectEntryDescriptor[Name]="Purchase Invoice"),
FILTER(PCProjectItem,PCProjectItem[Code]="Transport" && RELATED(PCProjectEntryDescriptor[Name])="Purchase Invoice")

Best Regards,

Teige

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.