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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
romidarmawan
New Member

How to filter columns and rows in a table based on certain value on another column

Hi, I am a new user of Power BI. Could you please help me with the following issue:

 

I have a table with a lot of columns. I would like to use a DAX function in which it will only show some columns of the table and the value of those column only if a value on another column matches certain criteria. For Example :

 

I have this table

 

Data[No], Data[Name], Data[Value], Data[Coverage Days]Data[Description]

 

I would like to create a function which display a table with only 2 columns and filter the rows of those columns with Coverage Days < 5:

 

Data[Name], Data[Value]

 

How can I achieve that result? Thank You.

1 ACCEPTED SOLUTION
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @romidarmawan,

 

Please new a calculated table with below DAX formula:

Result Table =
SELECTCOLUMNS (
    FILTER ( 'TData', Data[Coverage Days] < 5 ),
    "Name", Data[Name],
    "Value", Data[Value]
)

Alternatively, you can achieve this result via table visual without writing DAX.

Add Data[Name], Data[Value] to a Table visual. Add Data[Coverage Days] to visual level filter and set its value to <5.

2.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
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

3 REPLIES 3
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @romidarmawan,

 

Please new a calculated table with below DAX formula:

Result Table =
SELECTCOLUMNS (
    FILTER ( 'TData', Data[Coverage Days] < 5 ),
    "Name", Data[Name],
    "Value", Data[Value]
)

Alternatively, you can achieve this result via table visual without writing DAX.

Add Data[Name], Data[Value] to a Table visual. Add Data[Coverage Days] to visual level filter and set its value to <5.

2.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-yulgu-msft, Thanks for the reply.

 

I tried the formula you suggested, but it gave me an error prompt of "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.". 

 

With function SELECTCOLUMN, looks like I can't have a column with multiple values within it.

 

To be exact, this is what I am looking for :

 

I have this table 

DEPOTPRODUCTCOV DAYS
AAvtur6.86
APremium4
ASolar2.7
BAvtur14.3
BPremium14.3
BSolar4.3

 

And, I want a function that can generate this table (Coverage Days < 5):

DEPOTPRODUCT
APremium
ASolar
BSolar

 

I try to avoid using report visual filtering, because it will affect others visual chart too.

Hi,

 

Drag Depot and Product to the Row labels.  Write this measure

 

=SUM(Data[Cov days])

 

Apply a visual filter on the meaure with a criteria of <5.  The visual filter will only affect this specific filter. 


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

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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 Kudoed Authors