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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Patrick_Goh_YY
Regular Visitor

Using DAX to Create a Table

Hi Folks

 

Good day to you.

Need some help over here.

 

I am trying to use a text filter visual for the Employee ID here. Has been trying to figure how can I, upon entering  the Employee ID, filter out and show a table visual of the details of the person with same NRIC No.

 

I have got a set of sample data here.

NRIC NoEmployee IDNameDate JoinedDate ResignedDept
S1111111S1201111Patrick Goh03-May-8605-Jul-88HR
S1111111S1203332Patrick Goh06-Jan-9223-Dec-99HR
S1111111S1201212Patrick Goh25-Aug-18 IT
S2222222S1201313Susan Ong31-Jan-1523-Aug-18IT 
S2222222S1304431Susan Ong16-Sep-22 HR 
S3333333S1312353Alison Lim12-Dec HR
S4444444S1233332Joseph Tan08-Oct-1815-Jan-21HR
S4444444S16705555Joseph Tan16-Jan-21 HR

 

For example when I key in 1203332, I will see the 3 records of this person (1201111, 1203332 and 1201212) of the same NRIC no.

 

Purpose: To track rejoining staff. A staff may leave a company and rejoin again. A rejoin staff will be given a new Employee ID. However, NRIC No is the number that will never change, from the day we are birth till we die. Trying to see how I can create this to check.

 

Thanks for your help!

2 ACCEPTED SOLUTIONS

hi @Patrick_Goh_YY 

try the following:

1) plot a slicer based on a calculated table like:

Slicer = ALL(data[Employee ID])

 2) plot a table visual with all the columns, but filter the visual with a measure like:

measure = 
VAR _no = 
MAXX(
    FILTER(
        ALL(data),
        data[Employee ID]=SELECTEDVALUE(Slicer[Employee ID])
    ),
    data[NRIC NO]
)
RETURN
IF(
    MAX(data[NRIC NO])=_no,
    1, 0
)

choose 1.

 

it worked like:

FreemanZ_0-1683539647210.pngFreemanZ_1-1683539672610.pngFreemanZ_2-1683539688672.png

 

View solution in original post

tamerj1
Super User
Super User

Hi @Patrick_Goh_YY 

Please refer to attached sample file with the proposed solution

2.png3.png4.png

FilterMeasure = 
VAR EmpNames = 
    CALCULATETABLE ( 
        VALUES ( 'Table'[Name] ), 
        'Table'[Employee ID] IN VALUES ( Employee[Employee ID] ),
        ALL ( 'Table' )
    )
RETURN
    COUNTROWS ( 
        FILTER ( 
            'Table',
            'Table'[Name] IN EmpNames
        )
    )

View solution in original post

4 REPLIES 4
Patrick_Goh_YY
Regular Visitor

Thank you so much both!

tamerj1
Super User
Super User

Hi @Patrick_Goh_YY 

Please refer to attached sample file with the proposed solution

2.png3.png4.png

FilterMeasure = 
VAR EmpNames = 
    CALCULATETABLE ( 
        VALUES ( 'Table'[Name] ), 
        'Table'[Employee ID] IN VALUES ( Employee[Employee ID] ),
        ALL ( 'Table' )
    )
RETURN
    COUNTROWS ( 
        FILTER ( 
            'Table',
            'Table'[Name] IN EmpNames
        )
    )
Patrick_Goh_YY
Regular Visitor

Here's the sample data in a cleaner view

NRIC NoEmployee IDNameDate JoinedDate ResignedDept

S1111111S

1201111

Patrick Goh

03-May-8605-Jul-88

HR

S1111111S1203332Patrick Goh06-Jan-9223-Dec-99HR
S1111111S1201212Patrick Goh25-Aug-18 IT
S2222222S1201313Susan Ong31-Jan-1523-Aug-18IT
S2222222S1304431Susan Ong16-Sep-22 HR
S3333333S1312353Alison Lim12-Dec-22 HR
S4444444S1233332Joseph Tan08-Oct-1815-Jan-21HR
S4444444S1670555Joseph Tan16-Jan-21 HR

 

hi @Patrick_Goh_YY 

try the following:

1) plot a slicer based on a calculated table like:

Slicer = ALL(data[Employee ID])

 2) plot a table visual with all the columns, but filter the visual with a measure like:

measure = 
VAR _no = 
MAXX(
    FILTER(
        ALL(data),
        data[Employee ID]=SELECTEDVALUE(Slicer[Employee ID])
    ),
    data[NRIC NO]
)
RETURN
IF(
    MAX(data[NRIC NO])=_no,
    1, 0
)

choose 1.

 

it worked like:

FreemanZ_0-1683539647210.pngFreemanZ_1-1683539672610.pngFreemanZ_2-1683539688672.png

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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