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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

is Manager? give 1 else 0

Hi Team,

 

I have a question looks pretty simple, but not able to have a crack at it.

 

I have two columns Emp ID and Manager ID. 

 

I need a measure to get 1 when the emp ID is also listed in ManagerID. 

I tried this measure :

is manager? = if(contains(table, table[mgrID],"xyz"),1,0)

 

But this gives "1" next to the employees where the xyz is a manager for them.

 

I need to get in the below format.

 

Current results with above formula.
Emp IdMgr IDis Manager?
xyzeef0
abc1xyz1
abc2xyz1

 

I need : 
EmpIDMgr IDis Manager?
xyzeef1
abc1xyz0
abc2xyz0
9 REPLIES 9
Anonymous
Not applicable

Hi @Anonymous ,

 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.

 

Best Regards,

Yuna

Anonymous
Not applicable

Hi @Anonymous ,

 

Based on your description, You can create a measure as follows.

Measure_for_IsManager = IF(MAX([EmpID]) in DISTINCT(ALL('1 else 0_Test'[Mgr ID])),1,0)

Result:

v-yuaj-msft_0-1616140948445.png

Hope that's what you were looking for.

Best Regards,

Yuna

 

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

 

 

Anonymous
Not applicable

@Anonymous  Hi Thanks for the response. This works perfectly fine when i have the filter in the same report.  However, the filter is actually not from the same report in my situation. I have a another report and provided link to this report from where the EmpID filter value flows. 

 

The selectedvalue() captures the empid.  But its not passing it to the if condition below

is manager = if(contains(table, table[managerid], selectedvalue(empid)),1,0)

 

How do I make it happen?

Anonymous
Not applicable

Hi @Anonymous ,

 

Maybe I'm not getting what actually you are trying to do. Do you mean that EmpId is on another table in the same report? If the data (or fields) are not in the same report, DAX functions or M queries are disable to be used. 

Could you please share some sample data and the expected result to have a clear understanding of your question? I can do some tests for you. Some screenshots are welcome.

 

Best Regards,

Yuna

amitchandak
Super User
Super User

@Anonymous , Try a new column

is Manager =

if(countx(filter(Table, [EmpID] =earlier([Mgr ID])),[Mgr ID])+0 >1,1,0)

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

@amitchandak   

I cant have a new column as there is a restriction from my company so i need a measure.  Would it be possible?

@Anonymous , Try this one, I tested this

Measure 2 = if(countx(filter(allselected('Table'), max([Emp ID]) =([Mgr ID])),[Mgr ID])+0 >1,1,0)

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

@amitchandak  Hi again, this formula says "too few arguments passed to the filter function

@Anonymous , Not tested yet, something like this

 

if(countx(filter(allselected(Table), [EmpID] =max([Mgr ID])),[Mgr ID])+0 >1,1,0)

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

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

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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