Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I am trying to create a table using KEEPFILTERS with multiple OR conditions, but it seems that KEEPFIlTERS can only support AND relationships.
My scenario:
I want to filter out [Column 1], [Column 2], and [Amount] based on the conditions of [Type] OR [Category]. But KEEPFILTERS only allows an AND relationships. I want to see data that either matches [Type] condition OR [Category] condition.
EVALUATE
SUMMARIZECOLUMNS(
[Column 1],
[Column 2],
KEEPFILTERS(
TREATAS({XYZ},Type[Type])
),
KEEPFILTERS(
TREATAS({ABC},Catergory[Category])
),
[Amount]
)
Can anyone please tell me how to write the code? Thanks!
Solved! Go to Solution.
Hi, @ihungko
try to use union.
here is the documentation. UNION function (DAX) - DAX | Microsoft Learn
example code
DEFINE
TABLE TypeFilter =
CALCULATETABLE (
'YourTable',
TREATAS ( { "XYZ" }, 'YourTable'[Type] )
)
TABLE CategoryFilter =
CALCULATETABLE (
'YourTable',
TREATAS ( { "ABC" }, 'YourTable'[Category] )
)
EVALUATE
SUMMARIZECOLUMNS (
[Column 1],
[Column 2],
UNION ( TypeFilter, CategoryFilter ),
[Amount]
)
Proud to be a Super User!
Hi, @ihungko
try to use union.
here is the documentation. UNION function (DAX) - DAX | Microsoft Learn
example code
DEFINE
TABLE TypeFilter =
CALCULATETABLE (
'YourTable',
TREATAS ( { "XYZ" }, 'YourTable'[Type] )
)
TABLE CategoryFilter =
CALCULATETABLE (
'YourTable',
TREATAS ( { "ABC" }, 'YourTable'[Category] )
)
EVALUATE
SUMMARIZECOLUMNS (
[Column 1],
[Column 2],
UNION ( TypeFilter, CategoryFilter ),
[Amount]
)
Proud to be a Super User!
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
10 | |
8 | |
6 | |
6 | |
6 |