Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

LOOKUP return incorrect value for same ID

Hi guys, 

I'm walking in circles with this case, and I hope someone could help me.

 

I have two tables connected by One-To-Many relationship. 

 

Table 2 has the scenario below, where I have a column with the following formula:

EndThisMonth = IF(MONTH('DDA BaseVW_CostItem'[EndDate].[Date])=MONTH(TODAY()),"Yes", "No")

 

So far, so good.

 

In order to build a visual, I need to get the EndThisMonth status into Table1 based on CostItemID.

I tried a LOOKUP but I've got the error 'A table of multiple values was supplied where a single value was expected.'

Then this formula seemed to work:

PackageEndThisMonth =

CALCULATE(FIRSTNONBLANK('DDA BaseVW_CostItem'[EndThisMonth],1), FILTER(ALL('DDA BaseVW_CostItem'),VW_PlacementMonthlyBilling[CostItemId]='DDA BaseVW_CostItem'[CostItemId]))

 

But when I put the data from both tables side by side, I noticed the calculation above returns a different value for the same ID.

 

Does anyone know how I could fix this? I've also tried the formula below, but the same issue.

 

PackageEndThisMonth =
MAXX(
FILTER(
'DDA BaseVW_CostItem',
'DDA BaseVW_CostItem'[CostItemId]=EARLIER(VW_PlacementMonthlyBilling[CostItemId])
),
'DDA BaseVW_CostItem'[EndThisMonth]
)

4 Replies