- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Custom column help needed
segment1 | Category |
2000 | Air Transportation |
2000 | Donor Tissue Typing |
2000 | Ground Transportation |
2000 | Hospital & Physician Costs |
3000 | Air Transportation |
3000 | Hospital & Physician Costs |
3000 | Recovery Supplies |
3000 | Serology |
Need help with this custom column. It seems to work but as soon as I add the "and [segment1]" part, it does not work. segment1 is a text field. I have tried using quotes like "2000". Still doesn't work.
if List.Contains({"Hospital & Physician Costs","Surgeon Fees","Ground Transportation","Air Transportation","Serology","Donor Tissue Typing","Recovery Supplies","Other Organ Expenses"}, [Category]) and [segment1]=2000
then "Direct Organ"
else if List.Contains({"Hospital & Physician Costs","Surgeon Fees","Ground Transportation","Air Transportation","Serology","Donor Tissue Typing","Recovery Supplies","Historical Year Discards","Other Tissue Expenses"}, [Category])
then "Direct Tissue"
else "Other"
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

@csolanky your code works fine for me I am not getting any errors.
Categories is just a step I created to remove redundancy of the same list
= {"Hospital & Physician Costs","Surgeon Fees","Ground Transportation","Air Transportation","Serology","Donor Tissue Typing","Recovery Supplies","Other Organ Expenses"}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Added sample data.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hey @csolanky could you try swicth instead?
SWITCH (
TRUE,
List.Contains({"Hospital & Physician Costs","Surgeon Fees","Ground Transportation","Air Transportation","Serology","Donor Tissue Typing","Recovery Supplies","Other Organ Expenses"}, [Category]) && [segment1] = 2000, "Direct Organ",
List.Contains({"Hospital & Physician Costs","Surgeon Fees","Ground Transportation","Air Transportation","Serology","Donor Tissue Typing","Recovery Supplies","Historical Year Discards","Other Tissue Expenses"}, [Category]), "Direct Tissue",
"Other"
)
might do the trick!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

@BiAnalyst I get an error that SWITCH not recognized. I belive there is no built-in Switch function in Power Query. I could be wrong though.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

@csolanky What is the error message? Always mention that in your question. Check if the column name "segment1" doesn't have any trailing or leading spaces or any other unwanted characters.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

@csolanky How is there no error message? your question title says custom column error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Wrong choice of words for the title. Truly I needed help with teh custom column. Thanks for heads up!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

@csolanky your code works fine for me I am not getting any errors.
Categories is just a step I created to remove redundancy of the same list
= {"Hospital & Physician Costs","Surgeon Fees","Ground Transportation","Air Transportation","Serology","Donor Tissue Typing","Recovery Supplies","Other Organ Expenses"}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Thanks. Must be something else that is whacky on my end. Thanks for reponse.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
08-14-2024 05:41 AM | |||
07-13-2023 11:58 PM | |||
04-11-2023 02:59 AM | |||
04-10-2024 11:19 AM | |||
07-05-2024 12:39 PM |
User | Count |
---|---|
26 | |
25 | |
24 | |
13 | |
10 |
User | Count |
---|---|
24 | |
21 | |
18 | |
17 | |
10 |