简体   繁体   中英

Power BI Matrix sum totalling %ages incorrectly

I have a measure in PowerBI that looks like:

Measure 2 = IF(HASONEVALUE('CPP'[KPI Group]),
               SUMX('CPP',
                    DIVIDE(1,'Corporate Planning Project'[Full Year 
                    Budget],0)*'CPP'[Actual Y.T.D]
                  ),
               ""
              )

Basically my matrix looks like:

---- KPI Group ----ActualYTD ----FullYearBudget ----Measure2

A ----$29,666,609 ----$95,540,594 ----1804%

B ---- $2,297,809 ---- $20,153,995 ---- 503%

Once you drilldown into group A, the matrix looks like:

KPI Group ---- ActualYTD---- FullYearBudget---- Measure2

A>

----1415----$1,252,548----$322,180----388.77%

----2223----$821,236----$830,860----98.84%

etc, so you can see that at the drilled down level the Measure2 calculates correctly, it is only at the highest level that the Measure2 is being summed, and so the sum of ALL of the %ages added together comes to 1804%, instead of the measure calculating at that level too, which would sum of fullyear budgets divided by sum of ActualYTD as a percentage.

Can anyone help please?

Thankyou

It seems like the purpose of your Measure2 is to show [Actual YTD] as a percentage of [Full Year Budget] , and to only show that if you are in the context of a single [KPI group] .

The reason you aren't getting the result you expect is probably because you are using SUMX() where you shouldn't, SUMX() will calculate the percentage once for each row of the 'CPP' table and then add all of those together.

Try the following measure:

Measure 2 = 
    IF(
        HASONEVALUE(CPP[KPI Group]), 
        DIVIDE(
            SUM(CPP[Actual Y.T.D]), 
            SUM('Corporate Planning Project'[Full Year Budget]),
            0
        )
    )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM