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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
crln-blue
Post Patron
Post Patron

Custom matrix row subtotal

Hello! 

 

I have a matrix table with the following display:

crlnblue_0-1711342550110.png

My matrix table is pretty straightforward since I already adjusted the calculations. I turned off the subtotals option since I don't need it. However, when I minimize the Year, it still gives the subtotal that is automatically calculated by PowerBI:

crlnblue_1-1711342685781.png

I'm aware that I can adjust the formatting on the settings to make it blank but I would like to know if there are ways where I can control the display of the row subtotal? iLike a custom row subototal for the matrix table. The correct row subtotal are the values under the "Average of All Category" category of each year.

crlnblue_2-1711342893268.png

I checked for different solutions online and tried using HASONVALUE and ISINSCOPE but it doesn't display the value I wanted to.

 

Below is my sample data:

YearCategoryStatusValue
20231000Breakdown3
20231000Creation31
20231000Release15
20231000Approval59
20232000Breakdown1
20232000Creation5
20232000Release 
20232000Approval19
20233000Breakdown1
20233000Creation2
20233000Release11
20233000Approval1
20233000Breakdown2
20234000Creation1
20234000Release3
20234000Approval7
2023Average of All CategoryBreakdown3
2023Average of All CategoryCreation30
2023Average of All CategoryRelease13
2023Average of All CategoryApproval56
20241000Breakdown1
20241000Creation6
20241000Release138
20241000Approval2
20242000Breakdown3
20242000Creation10
20242000Release4
20242000Approval2
20243000Breakdown3
20243000Creation8
20243000Release26
20243000Approval1
20244000Breakdown1
20244000Creation1
20244000Release9
20244000Approval1
2024Average of All CategoryBreakdown2
2024Average of All CategoryCreation8
2024Average of All CategoryRelease124
2024Average of All CategoryApproval3

 

Thank you very much for the help!

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @crln-blue ,

 

Try this:

Formula =
IF (
    NOT ( HASONEVALUE ( 'Table'[Category] ) ),
    CALCULATE (
        SUM ( 'Table'[Value] ),
        'Table'[Category] = "Average of All Category"
    ),
    SUM ( 'Table'[Value] )
)

danextian_0-1711343546498.png

 










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


Proud to be a Super User!









"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.

View solution in original post

3 REPLIES 3
danextian
Super User
Super User

Hi @crln-blue ,

 

Try this:

Formula =
IF (
    NOT ( HASONEVALUE ( 'Table'[Category] ) ),
    CALCULATE (
        SUM ( 'Table'[Value] ),
        'Table'[Category] = "Average of All Category"
    ),
    SUM ( 'Table'[Value] )
)

danextian_0-1711343546498.png

 










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


Proud to be a Super User!









"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.

Thank you! It works! I'd like to ask, why the HASONEVALUE is used in Category and not Year? I first used it on Year but it doesn't get the right results.

To illustrate, year 2023 will always return as a single value for every item within its own group so if HASONEVALUE is applied to year, it will always return true. Ther are more than one category items at the year hierarchy level so using NOT(HASONEVALUE(table[category])) will return true only at that instance then  (except if there really is just one  category item  for that year) and false for every category item.










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


Proud to be a Super User!









"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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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