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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
ARUNTKAP
Frequent Visitor

Get Emp Name for the selected ID

I have columns ID, Name.

I'm using Text Filter to enter ID and filter the charts.

 

Requirement: I want the card to show Emp Name, if Length of the ID in the Text filter is equal to 10 characters.

 

 

2 ACCEPTED SOLUTIONS
rajulshah
Super User
Super User

Hello @ARUNTKAP,

Please try following measure:

EmpName = 
VAR SelectedID = SELECTEDVALUE(Table[ID])
VAR IDLength = LEN(SelectedID)
VAR EmpName = CALCULATE(MIN(Table[Name]),FILTER(Table,Table[ID]=IDLength))
RETURN IF(IDLength>=10,EmpName,BLANK())

Hope this helps. 

View solution in original post

Anonymous
Not applicable

Hi @ARUNTKAP 

 

Do you mean length of text used for seraching or length of result you get after search.

Example

your ids are

12345

45789

 

You type 123

So you are checking length of 123 or length of 12345?

 

If you are checking lengh of 123 then its not possible as text slicer is just used for searching purpose.

 

IF you want to check lenght of result after search that is 12345 then use below dax.

 

IF(LEN(MAX('Table'[ProductID/Category]))=10,MAX('Table'[EmpName]),BLANK())
 
Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar

If I resolve your problem Mark it as a solution and give kudos.

View solution in original post

5 REPLIES 5
rajulshah
Super User
Super User

Hello @ARUNTKAP,

Please try following measure:

EmpName = 
VAR SelectedID = SELECTEDVALUE(Table[ID])
VAR IDLength = LEN(SelectedID)
VAR EmpName = CALCULATE(MIN(Table[Name]),FILTER(Table,Table[ID]=IDLength))
RETURN IF(IDLength>=10,EmpName,BLANK())

Hope this helps. 

Small correction I did to get the answer:

Instead of FILTER(Table,Table[ID]=IDLength))
FILTERTable,Table[ID]=selectedId))

Anonymous
Not applicable

Hi @ARUNTKAP 

 

Do you mean length of text used for seraching or length of result you get after search.

Example

your ids are

12345

45789

 

You type 123

So you are checking length of 123 or length of 12345?

 

If you are checking lengh of 123 then its not possible as text slicer is just used for searching purpose.

 

IF you want to check lenght of result after search that is 12345 then use below dax.

 

IF(LEN(MAX('Table'[ProductID/Category]))=10,MAX('Table'[EmpName]),BLANK())
 
Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar

If I resolve your problem Mark it as a solution and give kudos.

Hi Pravin Wattamwar,
"If you are checking lengh of 123 then its not possible as text slicer is just used for searching purpose."

In what way can I make it possible. I just want to know the length of characters in the field.

Hi @Anonymous 

Thanks for your input. I shall use your dax formulas in future, for my other need.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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