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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
blestone111
Regular Visitor

Calculated column if error

Hi Experts

 

trying to write the following if statement and as calculated column, but its not working as expected..

 

FLAGS = IF('ORANGE (FACT)'[CSA_FLAG] = "Y" && 'ORANGE (FACT)'[CSE_FLAG] = "Y", "CSA and CSE",
                IF('ORANGE (FACT)'[CSE_FLAG] = "Y" && 'ORANGE (FACT)'[CSE_FLAG] = "N", "CSA Only",
                IF('ORANGE (FACT)'[CSE_FLAG] = "N" && 'ORNAGE (FACT)'[CSE_FLAG] = "Y", "CSE Only","")))
1 ACCEPTED SOLUTION
MNedix
Super User
Super User

Hi,

 

Use the Switch function and re-write your formula as below:

Flags (forum) =
SWITCH (
	True (),
	'ORANGE (FACT)'[CSA_FLAG] = "Y" && 'ORANGE (FACT)'[CSE_FLAG] = "Y", "CSA and CSE",
    'ORANGE (FACT)'[CSE_FLAG] = "Y" && 'ORANGE (FACT)'[CSE_FLAG] = "N", "CSA Only",
    'ORANGE (FACT)'[CSE_FLAG] = "N" && 'ORNAGE (FACT)'[CSE_FLAG] = "Y", "CSE Only")

 

If this solved your problem then please mark it as the solution so others can see it.

 

Best,



If the post helped then please give it a Kudos and mark it as the solution so others can see it.
Cheers,

View solution in original post

3 REPLIES 3
MNedix
Super User
Super User

Yes, because I copied your typos 🙂 You use the same CSE_FLAG in the 2nd and 3rd arguments.

Corrected below:

Flags (forum) =
SWITCH (
	True (),
	'ORANGE (FACT)'[CSA_FLAG] = "Y" && 'ORANGE (FACT)'[CSE_FLAG] = "Y", "CSA and CSE",
    'ORANGE (FACT)'[CSA_FLAG] = "Y" && 'ORANGE (FACT)'[CSE_FLAG] = "N", "CSA Only",
    'ORANGE (FACT)'[CSA_FLAG] = "N" && 'ORNAGE (FACT)'[CSE_FLAG] = "Y", "CSE Only")


If the post helped then please give it a Kudos and mark it as the solution so others can see it.
Cheers,
MNedix
Super User
Super User

Hi,

 

Use the Switch function and re-write your formula as below:

Flags (forum) =
SWITCH (
	True (),
	'ORANGE (FACT)'[CSA_FLAG] = "Y" && 'ORANGE (FACT)'[CSE_FLAG] = "Y", "CSA and CSE",
    'ORANGE (FACT)'[CSE_FLAG] = "Y" && 'ORANGE (FACT)'[CSE_FLAG] = "N", "CSA Only",
    'ORANGE (FACT)'[CSE_FLAG] = "N" && 'ORNAGE (FACT)'[CSE_FLAG] = "Y", "CSE Only")

 

If this solved your problem then please mark it as the solution so others can see it.

 

Best,



If the post helped then please give it a Kudos and mark it as the solution so others can see it.
Cheers,

Hi Mnedix dose not give the expected result

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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