cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
Lowe182
Regular Visitor

Total row not calculating correctly - Matrix Measure

Hello all,

 

I have tried other solutions to my problem but none of them worked for me. I have a matrix that projects annual expenses by pay period. For now, the "Projection" column fills in any missing or blank values with the same value as the previous year. See screenshot below:

 

Lowe182_0-1655845359069.png

Pay period 26 has not occured yet in 2022, so the value is replaced with the same amount as in 2021. Here is the projection calculation:

Projection =
IF (
    SUM ( DETAIL_FINAL[AMOUNT] ) = BLANK (),
    CALCULATE (
        SUM ( DETAIL_FINAL[AMOUNT] ),
        FILTER (
            ALLSELECTED ( A_DATETABLE[FY] ),
            A_DATETABLE[FY]
                SELECTEDVALUE ( A_DATETABLE[FY] ) - 1
        )
    ),
    SUM ( DETAIL_FINAL[AMOUNT] )
)

 

The problem I'm running into is the Totals column for Projection is not calculating correctly. It is ignoring the replaced value from PR26. My expected total for 2022 is 414,861,051.90.

 

I have tried the following, but no luck:

Projection_Total =
VAR _table =
    SUMMARIZE ( DETAIL_FINAL, DETAIL_FINAL[ID], "_value", [Projection] )
RETURN
    IF ( HASONEVALUE ( DETAIL_FINAL[ID] ), [Projection], SUMX ( _table, [_value] ) )

 

Any suggestions are greatly appreciated. Thank you.

3 REPLIES 3
Lowe182
Regular Visitor

Thank you for the proposed solution, unfortunately I'm still stuck on the getting the total to sum as intended:

 

Lowe182_0-1656341867432.png

 

My guess is this could be related to PR26 - FY2022 missing from the dataset completely, as this payroll has not been posted yet. 

 

Thank you

Hi @Lowe182 

Thanks for your reply.

In general, the correct total row can be obtained by creating 3 measures like this.

vxiaotang_0-1656491233457.png

If you want to continue troubleshooting, could you share a sample file? you can use bogus data to replace raw data.

 

 

Best Regards,

Community Support Team _Tang

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

v-xiaotang
Community Support
Community Support

Hi @Lowe182 

Thanks for reaching out to us.

Please try this, create the 3 measures below,

Projection Value=
IF (
    SUM ( DETAIL_FINAL[AMOUNT] ) = BLANK (),
    CALCULATE (
        SUM ( DETAIL_FINAL[AMOUNT] ),
        FILTER (
            ALLSELECTED ( A_DATETABLE[FY] ),
            A_DATETABLE[FY]
                = SELECTEDVALUE ( A_DATETABLE[FY] ) - 1
        )
    ),
    SUM ( DETAIL_FINAL[AMOUNT] )
)
Projection Total= sumx(DETAIL_FINAL,[Projection])
Projection=if(isfilterd(DETAIL_FINAL[ID]),[Projection Value],[Projection Total])

 

Best Regards,

Community Support Team _Tang

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

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

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

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors