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

Get Column based on filters from another table.

I have 2 tables. 

 

Table 1 has many columns including - CapacityPerDay, Assignee name, IterationId etc.. 

Table 2 has many columns including Assignee name, IterationId etc.. 

 

I need to  get CapacityPerDay from table 1 into table 2 based on Filter where Table1[IterationId] = Table2[IterationId] && Table1[Assignee] = Table2[Assignee]

 

There is Many to Many relation between tabels on IterationId column. 

 

I am using something like this : 

TeamMemberCapacity = CALCULATE(FIRSTNONBLANK(TeamCapacity[Custom.Column1.activities.capacityPerDay],MAX(TeamCapacity[Custom.Column1.activities.capacityPerDay])), TeamCapacity[IterationId] = CurrentSprint[IterationId] && TeamCapacity[Custom.Column1.teamMember.displayName.1] =CurrentSprint[Assignee])
 
Error : The expression contains multiple columns, but only a single column can be used in a True/False expression that is used as a table filter expression.
 
Could you please help? Thanks
1 ACCEPTED SOLUTION

This how I get a column from table2 to table1.Example 

New column in Table 1 = maxx(filter(table2,table1[customer] = table2[customer] && table2[option]="construction",table2[value])

New column in Table 1 = maxx(filter(table2,table1[Attribute] = table2[name] && table1[project] = table2[project],table[name])

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin

 

 

View solution in original post

5 REPLIES 5
az38
Community Champion
Community Champion

Hi @Anonymous 

try to use FILTER() and SELECTEDVALUE()

like

CALCULATE(FIRSTNONBLANK(TeamCapacity[Custom.Column1.activities.capacityPerDay],MAX(TeamCapacity[Custom.Column1.activities.capacityPerDay])), 
FILTER(ALL(TeamCapacity),
TeamCapacity[IterationId] = SELECTEDVALUE(CurrentSprint[IterationId]) && TeamCapacity[Custom.Column1.teamMember.displayName.1] =SELECTEDVALUE(CurrentSprint[Assignee]))
)

do not hesitate to give a kudo to useful posts and mark solutions as solution

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

Thanks @az38  It does not give me error now but all rows give me blank now. 

This how I get a column from table2 to table1.Example 

New column in Table 1 = maxx(filter(table2,table1[customer] = table2[customer] && table2[option]="construction",table2[value])

New column in Table 1 = maxx(filter(table2,table1[Attribute] = table2[name] && table1[project] = table2[project],table[name])

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin

 

 

Anonymous
Not applicable

Thanks @amitchandak it worked for me. 

az38
Community Champion
Community Champion

@Anonymous 

show please an example of your data model.

bytheway, why do you use 

FIRSTNONBLANK(TeamCapacity[Custom.Column1.activities.capacityPerDay],MAX(TeamCapacity[Custom.Column1.activities.capacityPerDay]))

but not simple

FIRSTNONBLANK(TeamCapacity[Custom.Column1.activities.capacityPerDay],1)

?

 

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

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.