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

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

Reply
Anonymous
Not applicable

Error in DAX?

I have written this formula as a part of custom column:

 

if[GRP]="3" then "Contract" else if[GRP]="4" then Contract" else if[GRP]="6" then "Contract" else if[GRP]="7" then "Contract" else if[GRP]="9" then "Contract" else if[GRP]="2" then "Contract" else if([GRP]="B" and [JOB] <> 12345) then "Contract" else "Regular Employee"

 

I executed the same for another table and it worked but whenn I create the same for another table and check for else if([GRP]="ZY" and [JOB] <> 12345) then "Contract" with filters it does not show regular for the job = 12345.

 

Any idea as to why this could happen? Because, it gets executed perfectly in another table. Basically if GRP=B and JOB is not equal to 12345 then it is under contract else, regular. But when I filter for GRP=B and JOB=12345 it still comes under contract for me. 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hey, I tried the same code again with the text instead of code and it worked

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

HI @Anonymous,

 

According to your description, I think your formula is m query instead of dax formula.

 

You can try to use below formula if it sutiable for your scenario.

 

M query formula:

#"Added Custom" = Table.AddColumn(#"Preview step", "Custom column", each if List.Contains({"2","3","4","6","7","9"},[GRP]) or ([GRP]="B" and [JOB] <> 12345) then "Contract" else "Regular Employee")

 

Dax formule:

Dax formula=
IF (
    OR (
        [GRP] IN { "3", "4", "6", "7", "9", "2" },
        AND ( [GRP] = "B", [JOB] <> 12345 )
    ),
    "Contract",
    "Regular Employee"
)

Regards,

Xiaoxin Sheng

Anonymous
Not applicable

Hey, I tried the same code again with the text instead of code and it worked

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.