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! Learn more

Reply
NDDD
Helper I
Helper I

DAX measure to place value based on table column

Good day, Need help, new at power bi. I connected to live data set and there is no option to change the tables. What I need is a measure that will replace/group column value to a new value Exs Column value is: A, B, C, D, E, F and I will need A, B to be “Y” and C, D to “X’ and E, F to “W”

 

Any suggestions.

 

Thanks

11 REPLIES 11
Anonymous
Not applicable

Hi @NDDD ,

 

Is there any update?

 

Best Regards,
Eyelyn Qin

HI @Anonymous 

 

 I apologize for the late reply, really sorry again. Thank you for your time.

Here is the update where I did move a bit froward 🙂

1. I created a measure to have the text column as a measure 

 MeasureI=IFERROR(values('table' [column] ),0)

2. Based on the measure above then I used

 Measure=  SWITCH(FALSE(), ISERROR(SEARCH("text",'table'[column])),"",                                                                                 ISERROR(SEARCH("text",'table'[column]","wanted text",

ISERROR(SEARCH("text",'table'[column]","wanted text" ,

ISERROR(SEARCH("text",'table'[column]","wanted text" ,  "")

 

Now when I use the created measure in the same table I do get the wanted result, the issue is when I use an additional table, then I get an error. Somehow the measure doesn't work when combined with other tables.

 

Thank you @Anonymous  

Anonymous
Not applicable

Hi @NDDD ,

 

I have tested the measure with  Live Connection mode. It works fine.

So could you please share some data sample/ error message / the returned results on your side to help us clarify your scenario?

 

Best Regards,
Eyelyn Qin

Anonymous
Not applicable

Hi @NDDD ,

 

Please try:

 

Measure =
SWITCH (
    TRUE (),
    MAX ( 'Table'[Column1] ) IN { "A", "B" }, "Y",
    MAX ( 'Table'[Column1] ) IN { "C", "D" }, "X",
    MAX ( 'Table'[Column1] ) IN { "E", "F" }, "W",
    MAX ( 'Table'[Column1] )
)

 

Output:

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@Anonymous Thank you for you input. Didn't work :(. Don't know if it bacuse the live cube or something esle

Shishir22
Solution Sage
Solution Sage

Can you please try - 

Measure = SWITCH(TRUE(), FIRSTNONBLANK('Table'[Column],0) IN {"A","B"},"Y",
                         FIRSTNONBLANK('Table'[Column],0) IN {"C","D"},"X",
                         FIRSTNONBLANK('Table'[Column],0) IN {"E","F"},"W")

 

Please mark it as answer if it resolves your issue. Kudos are also appreciated.

 

Cheers,
Shishir

Cheers,
Shishir

@Shishir22 thank you for the fast answer, but it didn't work. I forgot to mention there are other entries in the column not required to be grouped. Maybe this is causing the issue 

Hello @NDDD ,

 

If you are getting blanks for other entries, then you can try-

 

Measure = SWITCH(TRUE(), FIRSTNONBLANK('Table'[Column],0) IN {"A","B"},"Y",
                         FIRSTNONBLANK('Table'[Column],0) IN {"C","D"},"X",
                         FIRSTNONBLANK('Table'[Column],0) IN {"E","F"},"W",FIRSTNONBLANK('Table'[Column],0))

 

Please mark it as answer if it resolves your issue. Kudos are also appreciated.

 

Cheers,

Shishir

Cheers,
Shishir

@Shishir22 didn't work, got an error "This report measure has a syntax or semantic error"

amitchandak
Super User
Super User

@NDDD , This you have done in the table in the dataset, create a new column. Live connection you can not a add column

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak True, that is why I'm seeking help with DAX measure 

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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