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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
jcollier
Frequent Visitor

New column based on other's value

I have a table with two columns: employees and their status.

 

What I'd like to do:

I'd like to classify the status into two categories: active and inactive.

I know I should create new table only with status and its assigned category, then make a relationship.

 

Questions:

  1. How can I automatically classify status starting with number as 'inactive' category?
  2. How can I automatically classify status with text 'idle' as 'inactive' category?

 

Original table:

 

employeestatus
Johnidle
William 7861
Annatraining
Francescleaning
Jason

#foo

 

Table with categories:

 

statuscategory
idleinactive
7861inactive
trainingactive
cleaningactive
#fooinactive
1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

This catches everything except #foo, not sure of the parameters around #foo. Is it if it begins with a hashtag?

 

Column = IF(NOT(ISERROR(VALUE(LEFT([status],1)))) || [status] = "idle", "inactive", "active")


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

This catches everything except #foo, not sure of the parameters around #foo. Is it if it begins with a hashtag?

 

Column = IF(NOT(ISERROR(VALUE(LEFT([status],1)))) || [status] = "idle", "inactive", "active")


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thanks to you I also came up with solution that let's you calculate column based on first X letters e.g if value starts with "tr" it should be classified as "active".

 

Column = 
SWITCH(
TRUE();
IF(NOT(ISERROR(VALUE(LEFT('status'[status];1))));TRUE();FALSE());"active";
SEARCH("idle";'status'[status];;0)>0;"inactive";
SEARCH("tr";LEFT('status'[status];2);;0)>0;"active";
"other-category")

Awesome! Glad I could be of assistance!



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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