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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.