Forum Discussion
DAX Calculate IF OR Statement
- Anonymous10 years ago
CALCULATE(
SUM(Table[Column X]),
FILTER(
Table,
Table[Column A] = "Renewal" ||
Table[Column B] = "Needs Alignment")
)
CALCULATE(
SUM(Table[Column X]),
FILTER(
Table,
Table[Column A] = "Renewal" ||
Table[Column B] = "Needs Alignment")
)
- Anonymous6 years agoNot applicable
Lets say both values "renewal" and "needs assignment" are in column A,
is there a way to mention both values in the filter (or anywhere else) without haviing the mention Table [column a] twice?so instead of:
Table[Column A] = "Renewal" ||
Table[Column A] = "Needs Alignment"
Something like:
Table[Column A] = ("Renewal" || "Needs Alignment")
tried creating a VAR to return into my logical function but I dont get it right somehow
Any ideas? Anonymous
- Anonymous6 years agoNot applicable
Anonymous Table[Column A] IN {"Renewal", "Needs Assignment"}
- BKnecht10 years agoKudo Kingpin
That was so much easier than I was trying to make it, didn't even know about the Filter function, this worked perfectly, Thank you!
- Anonymous10 years agoNot applicable
CALCULATE(<expression>, FILTER( <table>, <table[column] = condition>)) is probably the most generally useful pattern to learn in DAX. The vast majority of measures I write either follow this pattern or contain a part that follows this pattern.
- dtartaglia9 years agoResolver I
Hi KHorseman,
The CALCULATE/FILTER syntax you supplied really helped me with DAX statements in general.
Thanks,
Dan