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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Anonymous
Not applicable

if Function in Custom Column - Why won't my Function accurately calculate the results?

I have an if Function that is working fine in terms of being able to calculate the results with no errors. The problem is I am currently learning PowerBI and Power Query through projects at work and I am unsure why the function I have written (in DAX via Custom Column - see below) isn't working correctly. 

 

All of my returning results are calculated as "Include" and there are multiple rows (16 to be exact) that should be calculated as "Exclude". All of the Columns references have been formatted to "Text" Value as well (see photo 2).

 

Formula Written in Custom Column

 

= if [CURR_STG_NAME]="Transacted - Lost" & [SPEC_STG_CD]="Marketing Lead" & [Days in Sale Cycle Stages]="0" then "Exclude" else "Include"

 

= if [CURR_STG_NAME]="Transacted - Lost" & [SPEC_STG_CD]="Marketing Lead" & [Days in Sale Cycle Stages]="0" then "Exclude" else "Include"

 

 

I have had to mark-out the column information as this is a work project and I am using privacy sensitive data (second photo only has the "Include" results that should be "Exclude"). But the only resulting rows are "Include" & there are still rows that would be "Exclude" as a result, returning as "Include", with that said on the Raw excel file, the "exclude" total was equal to the rows that would be "Exclude" as a result, returning as "Include". I am struggling to figure out how to get 100% accuracy to the function without syntax errors.  

 

I have tried the && instead of & with no success as the Syntax Error results with Token Literal Expected and the red squiggle underneath the "E" in [SPEC_STG_CD]. 

 

Photo 1

Created-Opty Include-Exclude Function.PNG

  

 

Photo 2

Created-Opty Include-Exclude if Function Pt.2.PNG

 

Hopefully this is enough context to recieve some guidance from the community, I appreciate anyone who has any thoughts or ideas! 

 

Thanks! 

1 ACCEPTED SOLUTION
cpearson
Resolver I
Resolver I

Try changing your &'s to and... i.e.

 

 

= if [CURR_STG_NAME]="Transacted - Lost" and [SPEC_STG_CD]="Marketing Lead" and [Days in Sale Cycle Stages]="0" then "Exclude" else "Include"

 

View solution in original post

2 REPLIES 2
cpearson
Resolver I
Resolver I

Try changing your &'s to and... i.e.

 

 

= if [CURR_STG_NAME]="Transacted - Lost" and [SPEC_STG_CD]="Marketing Lead" and [Days in Sale Cycle Stages]="0" then "Exclude" else "Include"

 

Anonymous
Not applicable

Thank you!! That worked!

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.