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

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

Reply
Anonymous
Not applicable

Switch Value to Text

I am trying to figure out how to create a new column that queries a word in column A and a word in column B and give a defined value. This needs to be able to do multiple words in each column to give a different value in new column.

1 ACCEPTED SOLUTION

Hello iamthearch,

 

Ah I see, it's just one table; there's no lookup table. You were close in your measure! Mine is below. The first main difference is the first parameter. I generally just set that to TRUE() because it's more intuitive to me. The second main difference is since you have multiple conditions, you have to combine them with an && into one condition; if you separate them with a comma, the SWITCH function thinks you're trying to move onto the next parameter. It only takes one condition, then the output to return, then another condition, then another output to return, etc.

Score = 
SWITCH (
    TRUE(),
    Sheet1[I Need] = "Account Access" && Sheet1[Category] = "User Setup", 3,
    Sheet1[I Need] = "Account Access" && Sheet1[Category] = "Password Reset", 2
    -- other values
)

 

Please let me know if you that works for you or if you were looking for something different. 😄


----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

9 REPLIES 9
Wilson_
Super User
Super User

Hello iamthearch,

 

It'd probably be helpful for you to provide some concrete examples of what you're looking for here.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Anonymous
Not applicable

I am doing a dashboard for Service Desk reporting, I have the data output from our ticketing setup and I want to give a score to types of tickets. Example I want to take column A "I Need" and column B "Category" and match each value to get a score of 1-5 that is set in my values

 

I Need                              Category                              Score

Account Access                User Setup                            3

Account Access                Password Reset                     1

Hardware                         Laptop Repair                        5

Hello,

 

So to confirm your situation, in your data model, you have:

  • One table as output from the ticketing setup that has the "I Need" and "Category" columns (and other fields)
  • A separate lookup table with three columns, including all the combinations of "I Need" and "Category" in the first two columns, and a third column of values that you want to be able to assign to individual tickets

And you want to be able to add a column to the first table, based on the appropriate value from the second table? Am I understanding correctly?




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Anonymous
Not applicable

I want to be able to do something like this


Switch( Table[Column],

Sheet1[I Need]="Account Access", Sheet1[Category]="User Setup" , 3,

Sheet1[I Need]="Account Access", Sheet1[Category]="Password Reset", 2,

// Add other values

)

Given that I'm still trying to understand what your data model looks like, I think it would be more productive if we discussed this in plain English and not DAX. 😄

 

Is my understanding from my last post correct? If not, can you please provide a sample pbix file?




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Anonymous
Not applicable

Is there an email that I can send you the PBIX File too

People tend to upload to dropbox or google drive, then share a link in their post. 🙂




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Anonymous
Not applicable

Hello iamthearch,

 

Ah I see, it's just one table; there's no lookup table. You were close in your measure! Mine is below. The first main difference is the first parameter. I generally just set that to TRUE() because it's more intuitive to me. The second main difference is since you have multiple conditions, you have to combine them with an && into one condition; if you separate them with a comma, the SWITCH function thinks you're trying to move onto the next parameter. It only takes one condition, then the output to return, then another condition, then another output to return, etc.

Score = 
SWITCH (
    TRUE(),
    Sheet1[I Need] = "Account Access" && Sheet1[Category] = "User Setup", 3,
    Sheet1[I Need] = "Account Access" && Sheet1[Category] = "Password Reset", 2
    -- other values
)

 

Please let me know if you that works for you or if you were looking for something different. 😄


----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Solution Authors
Top Kudoed Authors