Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
This is a follow-up to a different question I had, which was solved by @PaulDBrown.
I'm trying to find all ID values containing specific values. Example given here:
In this example I need to find all ID values that contain either "A" or "D" then assign a "1" to all rows with one of those ID values, regardless if the row contains "A", "D" or both.
Solved! Go to Solution.
Apologies...I was overthinking this. Try:
Only A or D =
VAR _Table =
CALCULATETABLE (
VALUES ( 'FactTable'[Cat1] ),
ALLEXCEPT ( FactTable, FactTable[ID] )
)
VAR _Vals = { "A", "D" }
VAR _Excpt =
EXCEPT ( _Table, _Vals )
RETURN
IF ( COUNTROWS ( _Excpt ) >= 1, 0, 1 )
Proud to be a Super User!
Paul on Linkedin.
@EVG-Questions , create a measure like
measure =
var _cnt = calculate(distinctcount(Table[cat1]) , filter(allselected(Table), Table[ID] =max(Table[ID])))
var _cnt2 = calculate(distinctcount(Table[cat1]) , filter(allselected(Table), Table[ID] =max(Table[ID]) && Table[cat1] in {"A", "D"}))
return
if(_cnt=2 && _cnt=_cnt2 ,1,0)
This doesn't seem to be working for me. The measure only generates "0". Could you perhaps explain the thought behind your approach?
Try:
Countrows A or D =
VAR _Table =
CALCULATETABLE (
VALUES ( 'FactTable'[Cat1] ),
ALLEXCEPT ( FactTable, FactTable[ID] )
)
VAR _Vals = { "A", "D" }
VAR _INTS =
INTERSECT ( _Table, _Vals )
RETURN
IF ( COUNTROWS ( _INTS ) >= 1, 1, 0 )
Proud to be a Super User!
Paul on Linkedin.
Thanks for the response @PaulDBrown!
This appears to be one step closer but doesn't quite solve it.
I'd like to get a list that exclusively consists of "A", "D" or both, whereas this creates a list of ID's that can also contain other values as long as there is an "A", "D" or both present.
Got it. I'm not in front of a PC now but try:
Countrows A or D =
VAR _Table =
CALCULATETABLE (
VALUES ( 'FactTable'[Cat1] ),
ALLEXCEPT ( FactTable, FactTable[ID] )
)
VAR _Vals = { "A", "D" }
VAR _INTS =
INTERSECT ( _Table, _Vals )
VAR _NotADCat =
EXCEPT ( _Table, _Vals )
VAR _Clean =
EXCEPT ( _INTS, _NotADCat )
RETURN
IF ( COUNTROWS ( _Clean ) >= 1, 1, 0 )
Proud to be a Super User!
Paul on Linkedin.
I might be doing something wrong, but it seems that this code produces the same outcome as your previous measure.
Apologies...I was overthinking this. Try:
Only A or D =
VAR _Table =
CALCULATETABLE (
VALUES ( 'FactTable'[Cat1] ),
ALLEXCEPT ( FactTable, FactTable[ID] )
)
VAR _Vals = { "A", "D" }
VAR _Excpt =
EXCEPT ( _Table, _Vals )
RETURN
IF ( COUNTROWS ( _Excpt ) >= 1, 0, 1 )
Proud to be a Super User!
Paul on Linkedin.
Thanks so much!
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.