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
joostvanham
Frequent Visitor

How to evaluate multiple occurances of an ID in combination with IF statements

Hi,

 

I'm trying to do the following:

 

IDABC
x012
y111
x100

 

I need to know which ID's have a value >0 for A, B and C. 

 

Based on the table above I expect both x and y to be returned.

 

I think I need a calculated column for this where I use EARLIER to evaluate all ID's in combination with a couple of IF statements. 

 

Hopefully you can help me in the right direction.

 

Cheers,

Joost

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@joostvanham 

is this what you want?

Column = 
var a=sumx(FILTER('Table','Table'[ID]=EARLIER('Table'[ID])),'Table'[A])
var b=sumx(FILTER('Table','Table'[ID]=EARLIER('Table'[ID])),'Table'[B])
var c=sumx(FILTER('Table','Table'[ID]=EARLIER('Table'[ID])),'Table'[C])
return if(a>0&&b>0&&c>0,"Yes")

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
ryan_mayu
Super User
Super User

@joostvanham 

is this what you want?

Column = 
var a=sumx(FILTER('Table','Table'[ID]=EARLIER('Table'[ID])),'Table'[A])
var b=sumx(FILTER('Table','Table'[ID]=EARLIER('Table'[ID])),'Table'[B])
var c=sumx(FILTER('Table','Table'[ID]=EARLIER('Table'[ID])),'Table'[C])
return if(a>0&&b>0&&c>0,"Yes")

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Yes! thank you @ryan_mayu! I had to add the ELSE value in your solution to make it work. This helps a lot!

you are welcome





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.