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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
MichaelHutchens
Helper IV
Helper IV

DAX table with filters and operators

Hi everyone, I'm trying to make a virtual table from an 'Employee' database that returns a list of employees. Each employee in the database might have multiple records, so in this virtual table, I only want the latest record with the highest record number, based on the 'Employee ID' field. I also only want records where the 'Current Employee Email Record' field = 'Y' OR the 'Employee Status' field = 'Withdrawn'.

So the logic should be = [Highest record number] AND ([Current Employee Email Record] OR [Employee Status])

I've given it a go with the table below, but I'm getting an error:

"Too few arguments were passed to the FILTER function. The minimum argument count for the function is 2."


Can anyone suggest where I'm going wrong? 🙂

Table 4 = 

FILTER(
ADDCOLUMNS(

'Employee',

"R", RANKX (

FILTER(

'Employee',

'Employee'[Email Address] =EARLIER ('Employee'[Email Address])), 'Employee'[Employee ID], , DESC) && 'Employee' [Current Employee Email Record]  =  "Y" || 'Employee' [Employee Status]  =  "Withdrawn"

),

 

3 REPLIES 3
v-junyant-msft
Community Support
Community Support

Hi @MichaelHutchens ,

Please try this DAX:

Table 4 =
VAR EmployeeLatestRecord = 
    ADDCOLUMNS(
        GROUPBY(
            'Employee',
            'Employee'[Employee ID],
            "MaxRecordNumber", MAXX(CURRENTGROUP(), 'Employee'[Record Number])
        ),
        "EmployeeDetails", CALCULATETABLE(
            'Employee',
            FILTER(
                'Employee',
                'Employee'[Record Number] = [MaxRecordNumber]
            )
        )
    )
RETURN
FILTER(
    EXPANDTABLECOLUMN(EmployeeLatestRecord, "EmployeeDetails"),
    'Employee'[Current Employee Email Record] = "Y" || 'Employee'[Employee Status] = "Withdrawn"
)

I'm not sure this is useful, if it doesn't solve your problem, please provide some sample data, thanks!

Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

gadielsolis
Super User
Super User

Please try the following:


FILTER(
ADDCOLUMNS(

'Employee',

"R", RANKX (

FILTER(

'Employee',

'Employee'[Email Address] =EARLIER ('Employee'[Email Address])), 'Employee'[Employee ID], , DESC) ,
'Employee' [Current Employee Email Record] = "Y" || 'Employee' [Employee Status] = "Withdrawn"

)

EDIT: I'd replied to your first post, not the correction

Thanks @gadielsolis , but I'm getting an error with that code:

MichaelHutchens_0-1705519789912.png

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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