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

Create a new column/measure based on filter conditions

Hi, 

 

As seen from the below table, I need to create a new column with name of the bank which is lead bank.

 

As in the example, Client Tata has multiple ID's and for each ID there are multiple Banks. Need to create a new column where bank name is only where is_lead = Yes.

 

I tried using ALL, ALLSELECTED and Filter condition, but unable to get the desired reult.

 

amitdarak_0-1631635000784.png

 

Regards,

Amit Darak

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Anonymous , Try a new column like

 

lead bank = maxx(filter(Table, [Client] = earlier([Client]) && [Is Lead] = "Yes"),[Bank])

View solution in original post

sevenhills
Super User
Super User

@amitchandak provided you the skeleton of the syntax.

 

Full column DAX is

Lead Bank Column = MAXX( FILTER(Table1, Table1[Client Name] = EARLIER(Table1[Client Name]) &&  Table1[ID] = EARLIER(Table1[ID]) && Table1[Is Lead] = "Yes"), Table1[Bank Name])

 

View solution in original post

5 REPLIES 5
sevenhills
Super User
Super User

It seems to be a new problem and frankly speaking you should open new thread. 

 

Below syntax is for new calculated column "Value"

 

 

Value = IF( MAXX(FILTER(LeadBank, LeadBank[ID] = EARLIER(LeadBank[ID])), LeadBank[Amt]) = "0","Match", "No Match") 

 

 

Other ways do exists like summarize, group by ... 

 

Bettery way is to have a sum column and then it helps rendering other visualizations

 
Sum Value = CALCULATE( Sum ( LeadBank[Amount]), FILTER(LeadBank, LeadBank[ID] = EARLIER(LeadBank[ID]) && LeadBank[Client Name] = EARLIER(LeadBank[Client Name])))
Anonymous
Not applicable

I tried above logic for another case but it does not give the appropriate result.

 

As seen in the image below, for 1 single ID if all values are 0, then value should be "Match" and if there is any non zero amt for ID then value should be Unmatch.

 

amitdarak_0-1638457163373.png

value = MAXX(FILTER('data',
'data'[ID] = EARLIER(data'[ID]) &&
'data'[Amt] = 0),"Match")
 
How do I modify my DAX for the above part?
sevenhills
Super User
Super User

@amitchandak provided you the skeleton of the syntax.

 

Full column DAX is

Lead Bank Column = MAXX( FILTER(Table1, Table1[Client Name] = EARLIER(Table1[Client Name]) &&  Table1[ID] = EARLIER(Table1[ID]) && Table1[Is Lead] = "Yes"), Table1[Bank Name])

 

amitchandak
Super User
Super User

@Anonymous , Try a new column like

 

lead bank = maxx(filter(Table, [Client] = earlier([Client]) && [Is Lead] = "Yes"),[Bank])

Anonymous
Not applicable

Hi,

 

This one worked. Thank you.

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.