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
Displaced_2000
Frequent Visitor

Totals and Subtotals in Matrix

Hello,

I have an issue with my subtotals and totals in a matrix, I've seen that this is a common issue and found many solutions but I cant seem to apply them in my scenario.

 

I have 2 tables of data

  • Properties (3 types) - including type (named 'Scheme Bridge')
  • Staff (3 roles) - including time spent on task relating to the type of properties (named 'Task Matrix')

The raw formula would be

Property Type 1 x Staff role 1 = row total

Property Type 1 x Staff role 2 = row total

Property Type 1 x Staff role 3 = row total

Property Type 1 x All Staff Roles = Subtotal

etc

 

So from that I am expecting an output of 9 rows and then 3 subtotals (and a overall total which i don't need)

I'm sure you already know what I'm going to say now, that my row totals are perfect but my subtotals don't calculate correctly.

 

I've done a fair bit of reading about this and have tried summerize and sumx etc.  I am sure that is where the solution lies but I'm just not experienced enough yet to work it out.

 

I would expect in the Co-ordinator subtotal to have 9038.63 (not 23K)

 

Displaced_2000_1-1626962470602.png

 

These are my current measures used in the above

 

 

Scheme count by TYP FIX = 
SUMX(
SUMMARIZE('Scheme bridge','Scheme bridge'[PRO_TYPE],"SUBTOTALSFIX",[Scheme count by TYPE]),[SUBTOTALSFIX])
TOTAL TIME FINAL SUBTOTAL FIX = 
SUMX(
SUMMARIZE('Task Matrix','Task Matrix'[PRO_TYPE],"SUBTOTALSFIX",[Time by role and TYP]),[SUBTOTALSFIX])
total FIX = [Scheme count by TYP FIX]*[TOTAL TIME FINAL SUBTOTAL FIX] 

 

 

 

 

Many Thanks for any guidance

1 ACCEPTED SOLUTION

Hi @Displaced_2000 ,

you can try this measure:

total FIX =
VAR _t =
    ADDCOLUMNS (
        SUMMARIZE ( 'Scheme bridge', 'Scheme Bridge'[PRO_ATY_DESCR] ),
        "@total", [Scheme count by TYP FIX] * [TOTAL TIME FINAL SUBTOTAL FIX]
    )
RETURN
    IF (
        ISINSCOPE ( 'Scheme Bridge'[PRO_ATY_DESCR] ),
        [Scheme count by TYP FIX] * [TOTAL TIME FINAL SUBTOTAL FIX],
        SUMX ( _t, [@total] )
    )

If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

View solution in original post

3 REPLIES 3
Displaced_2000
Frequent Visitor

Hello,

 

I've produced a file with some test data and recreated all the measures to match the above.  Some of the numbers are different but the logic should be the same.

 

Test_Data LINK 

 

Any support with this would be appreciated. Cheers

 

Hi @Displaced_2000 ,

you can try this measure:

total FIX =
VAR _t =
    ADDCOLUMNS (
        SUMMARIZE ( 'Scheme bridge', 'Scheme Bridge'[PRO_ATY_DESCR] ),
        "@total", [Scheme count by TYP FIX] * [TOTAL TIME FINAL SUBTOTAL FIX]
    )
RETURN
    IF (
        ISINSCOPE ( 'Scheme Bridge'[PRO_ATY_DESCR] ),
        [Scheme count by TYP FIX] * [TOTAL TIME FINAL SUBTOTAL FIX],
        SUMX ( _t, [@total] )
    )

If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

Many thanks, this worked perfectly 😀

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.