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
ybicalways79
Frequent Visitor

DAX FILTER with multiple criteria

Hello,

 

This has been challenging to figure out.  I have tableA with ITEMs / Category / Sales.  I want add a column "Groups" to that table based on another table below.  lookup to category and then where the sales number fits between MIN and MAX columns.  Is that possible?

 

tableA

ITEMs

ItemCategorySales
OTH-10AC_CAPS0
OTH-12AC_CAPS10
F-30AC_FTG0
H-22AUXCOOL0
H-23AUXCOOL1
H-24AUXCOOL26
H-25AUXCOOL101

 

tableB

GroupsCategoryMinMax
UnrankedAC_CAPS00
A - Rank 1-25AC_CAPS125
UnrankedAC_FTG00
UnrankedAUXCOOL00
A - Rank 1-25AUXCOOL125
B - Rank 26-100AUXCOOL26100
C - Rank 101-250AUXCOOL101250

 

RankGroup =
CALCULATE( SELECTEDVALUE( tableB[Groups], BLANK() ),
    FILTER( ALL( 'tableB' ),
        tableA[Category] = tableB[Category] &
        tableA[Sales] >= tableB[Min] &
        tableA[Sales] < tableB[Max])
)
1 ACCEPTED SOLUTION
wdx223_Daniel
Super User
Super User

RankGroup=MAXX(FILTER(TableB,TableB[Category]=TableA[Category]&&TableB[Min]<=TableA[Sales]&&TableB[Max]>=TableA[Sales]),TableB[Groups])

View solution in original post

2 REPLIES 2
wdx223_Daniel
Super User
Super User

RankGroup=MAXX(FILTER(TableB,TableB[Category]=TableA[Category]&&TableB[Min]<=TableA[Sales]&&TableB[Max]>=TableA[Sales]),TableB[Groups])

Thanks!  Worked perfectly

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.

Top Solution Authors