cancel
Showing results for 
Search instead for 
Did you mean: 
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
Exciting changes

Power BI Community Changes

Check out the changes to the Power BI Community announced at Build.

May 2023 update

Power BI May 2023 Update

Find out more about the May 2023 update.

Kudo Data Story carousel

Data Stories Gallery

Visit our Data Stories Gallery and give kudos to your favorite Data Stories.

Top Solution Authors