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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

if statement lookup

i need a formula like this 

if an employee has in column Action ONLY "plan"= 1 otherwise 2.  see picture below.

if statement lookup.JPG

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi, @Anonymous 

You could also use this formula

Result Column = 
IF (
    'Table'[Action] = "Plan"
        && CALCULATE (
            COUNTA ( 'Table'[Action] ),
            FILTER ( 'Table', 'Table'[Name employee] = EARLIER ( 'Table'[Name employee] ) )
        ) = 1,
    1,
    2
)

Result:

1.JPG

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-lili6-msft
Community Support
Community Support

hi, @Anonymous 

You could also use this formula

Result Column = 
IF (
    'Table'[Action] = "Plan"
        && CALCULATE (
            COUNTA ( 'Table'[Action] ),
            FILTER ( 'Table', 'Table'[Name employee] = EARLIER ( 'Table'[Name employee] ) )
        ) = 1,
    1,
    2
)

Result:

1.JPG

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
tex628
Community Champion
Community Champion

IF(
CALCULATE(
SELECTEDVALUE([Action]) , 
ALL('Table'),
[Employee name] = EARLIER([Employee name])
) = "Plan" , 1 , 0 )

Connect on LinkedIn

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.