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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.