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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
blestone111
Helper I
Helper I

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
Solution Sage
Solution Sage

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
Solution Sage
Solution Sage

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
Solution Sage
Solution Sage

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.