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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

obtain specific value based on multiple conditions

Hi all,

 

I have the following dataset

CustomerTypeSubtypeMonitoring Result
AAAX1INTERNAL OK
AAAY2EXTERNAL KO
AAAX3EXTERNAL OK
BBBX1INTERNAL OK
BBBY1EXTERNAL OK
BBBY2INTERNAL OK
CCCX2INTERNAL OK
CCCY3EXTERNAL OK
CCCY3INTERNAL KO
CCCY3INTERNAL KO

 

I need to create a Measure to obtain:

  • -1 if one or more Monitoring are EXTERNAL and are KO
  • if one or more Monitoring are INTERNAL and are KO
  • 1 if I have all OK

So in the sample Data exposed above, for Customer AAA I need my Measure displays -1 because one row has EXTERNAL and KO, for Customer BBB I want 1 because I have all OK, and for customer CCC I need 0 because I have more than one INTERNAL in KO (but would have been sufficient only one KO).

 

 

Thanj you a lot!!!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

Measure = 
VAR _SUMMARIZE = SUMMARIZE('Table','Table'[Customer],'Table'[Monitoring],'Table'[Result],"Combine",COMBINEVALUES(" ",'Table'[Monitoring],'Table'[Result]))
VAR _VALUECOMBINE = SUMMARIZE(FILTER(_SUMMARIZE,[Customer] = MAX('Table'[Customer])),[Combine])
VAR _COUNTROW = CALCULATE(COUNT('Table'[Customer]))
VAR _COUNTRESULT = CALCULATE(DISTINCTCOUNT('Table'[Result]))
RETURN
SWITCH(TRUE(),_COUNTRESULT=1&&"OK" IN VALUES('Table'[Result]),1,"INTERNAL KO" IN _VALUECOMBINE,0,"EXTERNAL KO" IN _VALUECOMBINE,-1)

Result is as below.

1.png

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Wouldn't you want a calculated column formula solution instead? 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi @Anonymous ,

Measure = 
VAR _SUMMARIZE = SUMMARIZE('Table','Table'[Customer],'Table'[Monitoring],'Table'[Result],"Combine",COMBINEVALUES(" ",'Table'[Monitoring],'Table'[Result]))
VAR _VALUECOMBINE = SUMMARIZE(FILTER(_SUMMARIZE,[Customer] = MAX('Table'[Customer])),[Combine])
VAR _COUNTROW = CALCULATE(COUNT('Table'[Customer]))
VAR _COUNTRESULT = CALCULATE(DISTINCTCOUNT('Table'[Result]))
RETURN
SWITCH(TRUE(),_COUNTRESULT=1&&"OK" IN VALUES('Table'[Result]),1,"INTERNAL KO" IN _VALUECOMBINE,0,"EXTERNAL KO" IN _VALUECOMBINE,-1)

Result is as below.

1.png

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors