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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
PawelK0296
New Member

Exclude data from Subtotals in Power BI Matrix (But Keep Row Values)

Hello,

Below is a high-level overview of my issue.

Data Model:

I have three tables:

  • Table A: FS Account, Date
  • Table B: Date, FS Account, Level 1, Level 2, ..., Level 5
  • Table C: Date, FS Account, Value

Matrix Setup:

I'm using a matrix visual with a 5-level hierarchy (e.g., Level 1 → Level 2 →Level 3→Level 4→Level 5→ FS Account). Some levels contains statistical accounts, which always start with "S" (e.g., S1010).

What I want to achieve:

  • Keep statistical accounts visible in the matrix rows.
  • Exclude them from subtotals and totals at higher levels.

Example:

Level 1                  Level 2                FS Account                                  Value

Fixed IncomeGov Bonds1010 - Treasury Bonds100,000,000
  S1010 - Statistical Adjustment5,000,000
  S1020 - Statistical Offset3,000,000
 Subtotal Level 2 100,000,000 ← should exclude S1010 and S1020
 Gov Bonds 21011 - Treasury Bonds100,000,000
  S1011 - Statistical Adjustment5,000,000
  S1021 - Statistical Offset3,000,000
 Subtotal Level 2 100,000,000 ← should exclude S1010 and S1020
Subtotal Level 1  200,000,000

Could you please let me know if it possible to achive that? I know i can exclude the statistical accounts but then that value are not visible. 

 

Thank you!

5 REPLIES 5
v-sdhruv
Community Support
Community Support

Hi @PawelK0296 ,
Just wanted to check if you had the opportunity to review the suggestion provided?
If the response has addressed your query, please accept it as a solution  so other members can easily find it.
Thank You

v-sdhruv
Community Support
Community Support

Hi @PawelK0296 ,
Just wanted to check if you had the opportunity to review the suggestion provided?
If the response has addressed your query, please accept it as a solution  so other members can easily find it.
Thank You

v-sdhruv
Community Support
Community Support

Hi @PawelK0296 ,
Just wanted to check if you had the opportunity to review the suggestion provided?
If the response has addressed your query, please accept it as a solution  so other members can easily find it.
Thank You

techies
Solution Sage
Solution Sage

Hi @PawelK0296 please try this measure

 

VAR IsSub = NOT HASONEVALUE('Values'[FS Account])
RETURN
IF(
    IsSub,
    CALCULATE(
        SUM('Values'[Value]),
        FILTER(
            ALL('Values'[FS Account]),
            LEFT('Values'[FS Account], 1) <> "S"
        )
    ),
    SUM('Values'[Value])
)
― Power BI | Microsoft Fabric | PL-300 | DP-600 | Blog: medium.com/@cseprs_54978
maruthisp
Solution Specialist
Solution Specialist

Hi PawelK0296,

 

As per your original post, assuming you have value column is TableC[Value] and FS Account is in TableC[FS Account]:

Adjusted Value =
VAR IsTotal = HASONEVALUE('TableC'[FS Account]) = FALSE
RETURN
IF(
IsTotal,
CALCULATE(
SUM('TableC'[Value]),
NOT STARTSWITH('TableC'[FS Account], "S")
),
SUM('TableC'[Value])
)

Above DAX measure does below:
1.Detects if the current row is a total/subtotal.
2.Excludes statistical accounts (those starting with "S") from totals.
3.Includes all accounts in row-level values.

Please let me know if you have further questions.

If this reply helped solve your problem, please consider clicking "Accept as Solution" so others can benefit too. And if you found it useful, a quick "Kudos" is always appreciated, thanks! 

 

Best Regards, 

Maruthi 

LinkedIn - http://www.linkedin.com/in/maruthi-siva-prasad/ 

X            -  Maruthi Siva Prasad - (@MaruthiSP) / X

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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