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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
han_rj
Helper IV
Helper IV

Hide a row in Matrix

Hi Team,

 

I have created a matrix to show me Product wise sales for 2023,2024 and 2025.

I would like to hide rows where the sales of 2023 is 0.00 and the following years are "-"[No values]

 

Current View [ I want the highlighted row excluded]

han_rj_0-1752889005640.png

 

Expected View

han_rj_1-1752889240125.png

Measure Logic

Sales_2023 = COALESCE(SUM(Sheet1[2023 Sales])/1000000,"-")
Sales_2024 = COALESCE(SUM(Sheet1[2024 Sales])/1000000,"-")
Sales_2025 = COALESCE(SUM(Sheet1[2025 Sales])/1000000,"-")

 

 

1 ACCEPTED SOLUTION
rohit1991
Super User
Super User

Hi @han_rj ,
To hide rows in your Power BI matrix where Sales_2023 is 0 and the following years have no values ("-"), create a new measure like this:

Show Row =
IF (
    [Sales_2023] <> 0
    || [Sales_2024] <> "-"
    || [Sales_2025] <> "-",
    1,
    0
)

 


Add this Show Row measure to your matrix as a visual-level filter and set it to show only when value is 1. This will hide rows where 2023 is 0 and the other years are blanks/"-".

 

 

Power BI doesn’t support direct row hiding, but filtering using a measure like this achieves the desired effect.


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

View solution in original post

4 REPLIES 4
danextian
Super User
Super User

Hi @han_rj 

 

I would have modeled this differently. Instead of  keeping separate columns for each year and then individual measures for those columns, I would unpivot so there's one column each for year and value and use format strings so zero are shown as  -. That aside, try this measure as a visual filter

IF ( [Sales_2023] = 0 && [Sales_2024] = "-" && [Sales_2025] = "-", 1, 0 )

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
Sandip_Palit
Resolver II
Resolver II

Step 1: Create the New Filter Measure
First, create the DAX measure that will check for your condition.
In Power BI Desktop, go to the Modeling tab or right-click your table in the Data pane.
Select New Measure.

Copy and paste the following DAX formula into the formula bar:

Filter Rows =
VAR Sales2023 = SUM(Sheet1[2023 Sales])
VAR Sales2024 = SUM(Sheet1[2024 Sales])
VAR Sales2025 = SUM(Sheet1[2025 Sales])
RETURN
IF(
AND(Sales2023 = 0, ISBLANK(Sales2024), ISBLANK(Sales2025)),
0,
1
)

This code checks each row to see if Sales in 2023 are zero AND sales in both 2024 and 2025 are blank. It assigns 0 to these specific rows and 1 to all others.

Step 2: Apply the Measure as a Filter
Click on your Matrix visual to select it.
Go to the Filters pane and find the Filters on this visual section.
From the Data pane, drag your new measure, Filter Rows, into the "Filters on this visual" area.
A new filter card will appear. Set the Show items when the value dropdown to is and type 1 in the box.
Click Apply filter.

 

If this explanation and solution resolve your issue, please like and accept the solution.

rohit1991
Super User
Super User

Hi @han_rj ,
To hide rows in your Power BI matrix where Sales_2023 is 0 and the following years have no values ("-"), create a new measure like this:

Show Row =
IF (
    [Sales_2023] <> 0
    || [Sales_2024] <> "-"
    || [Sales_2025] <> "-",
    1,
    0
)

 


Add this Show Row measure to your matrix as a visual-level filter and set it to show only when value is 1. This will hide rows where 2023 is 0 and the other years are blanks/"-".

 

 

Power BI doesn’t support direct row hiding, but filtering using a measure like this achieves the desired effect.


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!
Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file.


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

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors