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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
anandav
Skilled Sharer
Skilled Sharer

Using a text field in a DAX measure

Hi,

 

While trying to answer a question in this forum I hit a problem.

How can I use a text field in a measure?

e.g.

Dept   Employees

A           2

B           3

 

So how can I do:

Measure := IF('File'[Dept]="A", "This is dept A", "Not dept A")

 

I can do this for a column in a Dax new column or in M via Query Editor.

I understand in a measure there is no row context and need to use an aggregate function (for numeric fields) or calculate function.

 

But cannot figure out how the text field checking can be done in a measure.

1 ACCEPTED SOLUTION
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @anandav

 

Give this a try

 

Measure := IF( MAX('File'[Dept])="A", "This is dept A", "Not dept A")

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

2 REPLIES 2
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @anandav

 

Give this a try

 

Measure := IF( MAX('File'[Dept])="A", "This is dept A", "Not dept A")

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Worked!

Never thought of using MAX for text field. Smiley Happy

Thanks a lot.

 

Helpful resources

Announcements
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 Kudoed Authors