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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Help Needed Please! Tried using Lookup But Error "a table of multiple values was supplied

Hi,

 

Need a help to solve below conditions. 

 

When I tried using Lookup Value, error was ccoming like "a table of multiple values was supplied where a single value was expected". Please help.

 

Below is the Data and I was trying to get the Manager Territory and  True / False as shown in the below Table:

 

IdNameTerritory IdParent Territory IdManager IDManager NameManager Territory (Calculated Field)True / False (Calculated Field)
1AA001A0055EE TRUE
2BA002A00516FF TRUE
3CA003A0057GG FALSE
3CA004A0077GG TRUE
4DA003A0099II FALSE
5EEA005A0099100JJJ  
6FFA0051A005555EEE  
7GGA006A005566FFF  
7GGA007A008866FFF  
9IIA008A0099100JJJ  
10JJA009A005555EEE  

 

Requirements are:

1. Manager Territory should get populated by Looking the Manager ID in Column "ID" and get the respective Territory ID from Column "Territory Id"

2. Now the Calculated Column "Manager ID" should be matched with column "Parent Territory Id" to flag the true or false. We are doing this since there is a possibility that the Parent Territory ID is wrong mapped for ID. 

For example: ID = 3, his Manage is 7 and Parent Territory id is A005. But the correct parent territory id is A006.

Note: If we are not able to get the Manager ID column, we can ignore it. But we need the Flagging column, whether it is True or False.

 

Challenges:

One ID (can be manager as well) can have 2 or more territories. So it should be true if the Parent Territory ID falls in any of the Manager ID of the respective Manager. 

 

For Example: ID 7, he have two territories A006 and A007

 

Thanks a lot in advance.

4 REPLIES 4
AlexisOlson
Super User
Super User

How about this?

IsOK =
IF (
    Data[Manager ID] IN VALUES ( Data[Id] ),
    CONTAINS (
        FILTER ( Data, Data[Id] = EARLIER ( Data[Manager ID] ) ),
        Data[Territory Id], Data[Parent Territory Id]
    ),
    TRUE ()
)

 

You can list the Manager Territories by using CONCATENATEX instead of CONTAINS.

AlexisOlson_0-1634227147013.png

 

Greg_Deckler
Super User
Super User

@Anonymous So the problem that I see in this is that I am not sure how to code something that removes the ambiguity around who is the correct manager. For example, for the Parent Territory Id of A005 the data says that the Manager ID is 5, 6 and 7. The 5 and 6 are correct but the seven is incorrect. But, you know that because you are a human that has this business knowledge. However, what is there to tell the code that this is the case?

 


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hi Greg,

 

Thanks for the reply. 

 

Sorry for creating confusion. 

 

Territory ID of 5 is A005, 6 is A0051 and 7 is A006. The updated data is provided below.

 

So here Parent ID is as per what is there in the System for a particular ID. So there is a posibility the same is tagged wrongly. 

For Example: In ID 3, Manager is ID 7, so the Parent territory should have been A006 (which is the Territory ID of ID 7). But in system it is wrongly tagged as A005, which is the Territory ID of ID 5.  So here a flag should come as False.

 

Trust I didn't confuse you more. Could you please check the below updated Data?

 

IdNameTerritory IdParent Territory IdManager IDManager NameManager Territory (Calculated Field)True / False (Calculated Field)
1AA001A0055EE TRUE
2BA002A00516FF TRUE
3CA003A0057GG FALSE
3CA004A0077GG TRUE
4DA003A0099II FALSE
5EEA005A0099100JJJ  
6FFA0051A005555EEE  
7GGA006A005566FFF  
7GGA007A008866FFF  
9IIA008A0099100JJJ  
10JJA009A005555EEE  
Anonymous
Not applicable

@VahidDM @Greg_Deckler @amitchandak @AlexisOlson @Jihwan_Kim 

Trust you are well.

Could you please help on the above?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors