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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
uvil
Resolver I
Resolver I

Issues with measure and Grand Total

Good afternoon guys, 

 

I have an issue doing a measure, as you can see in the right column I have the original sums of the table, but in 2 groups (_1, _6), I have to divide de total in 3, (Original / 3), The measure have a lot of logic inside, but at the end it returns the correct values, the problem is that the grand total of the measured column is not the same as the sum of the column.

 

The issue is that calculating the Grand Total, it doesnt show as it have to be with the values showed on the matrix, 

 

I tried a lot of ways to do it from this forum but I didn't found any answer that fits well to me, 

PBIForum.png
Regards,.

1 ACCEPTED SOLUTION

Hello guys, 

I solved the issue doing this new measure, now all works fine, 

 

Saldo Right Amount = IF(HASONEVALUE(DIM_Cross[Group]), [/3], SUMX(VALUES(DIM_Cross[Group]), [/3]))

 

Also I got the credit from here, maybe it can help you guys in the future,

https://www.youtube.com/watch?v=ufHOOLdi_jk&app=desktop&ab_channel=Curbal

View solution in original post

3 REPLIES 3
uvil
Resolver I
Resolver I

Original = CALCULATE(SUM(DIM_Historic[Earning]) - SUM(DIM_Historic[Debt])) + 0

 

/3 =
VAR _MinFecha =
SELECTEDVALUE ( DIM_Historic[MonthFechaDiario] )
VAR _MinGrupo =
SELECTEDVALUE ( DIM_Cross[Group] )
VAR _SaldosCalculados =
IF (
_MinFecha IN { 1, 4, 7, 10 }
&& _MinGrupo IN { "_1", "_6" },
[Saldo] / 3,
[Saldo]
)
RETURN
//_SaldosCalculados
IF (
_MinGrupo IN { "_1", "_6" }
&& _MinFecha = 2,
CALCULATE (
SUM ( DIM_Historic[Earning] ) - SUM ( DIM_Historic[Debt] ),
DATEADD ( Fecha[Date], -1, MONTH )
) / 3 + _SaldosCalculados,
IF (
_MinGrupo IN { "_1", "_6" }
&& _MinFecha = 3,
CALCULATE (
SUM ( DIM_Historic[Earning] ) - SUM ( DIM_Historic[Debt] ),
DATEADD ( Fecha[Date], -2, MONTH )
) / 3 + [Saldo],
IF (
_MinGrupo IN { "_1", "_6" }
&& _MinFecha = 5,
CALCULATE (
SUM ( DIM_Historic[Earning] ) - SUM ( DIM_Historic[Debt] ),
DATEADD ( Fecha[Date], -1, MONTH )
) / 3 + _SaldosCalculados,
IF (
_MinGrupo IN { "_1", "_6" }
&& _MinFecha = 6,
CALCULATE (
SUM ( DIM_Historic[Earning] ) - SUM ( DIM_Historic[Debt] ),
DATEADD ( Fecha[Date], -2, MONTH )
) / 3 + [Saldo],
IF (
_MinGrupo IN { "_1", "_6" }
&& _MinFecha = 8,
CALCULATE (
SUM ( DIM_Historic[Earning] ) - SUM ( DIM_Historic[Debt] ),
DATEADD ( Fecha[Date], -1, MONTH )
) / 3 + _SaldosCalculados,
IF (
_MinGrupo IN { "_1", "_6" }
&& _MinFecha = 9,
CALCULATE (
SUM ( DIM_Historic[Earning] ) - SUM ( DIM_Historic[Debt] ),
DATEADD ( Fecha[Date], -2, MONTH )
) / 3 + [Saldo],
IF (
_MinGrupo IN { "_1", "_6" }
&& _MinFecha = 11,
CALCULATE (
SUM ( DIM_Historic[Earning] ) - SUM ( DIM_Historic[Debt] ),
DATEADD ( Fecha[Date], -1, MONTH )
) / 3 + _SaldosCalculados,
IF (
_MinGrupo IN { "_1", "_6" }
&& _MinFecha = 12,
CALCULATE (
SUM ( DIM_Historic[Earning] ) - SUM ( DIM_Historic[Debt] ),
DATEADD ( Fecha[Date], -2, MONTH )
) / 3 + [Saldo],
IF (
_MinGrupo = "1",
[KPI_TotalSells],
IF (
_MinGrupo = "2",
[KPI_TotalProduction],
IF (
_MinGrupo = "3",
[KPI_MargenBruto],
IF (
_MinGrupo = "4",
[KPI_EBITDA],
IF (
_MinGrupo = "5",
[KPI_EBIT],
IF (
_MinGrupo = "6",
[KPI_BeforeTaxes],
IF (
_MinGrupo = "7",
[KPI_FinalBeforeTaxes],
IF (
_MinGrupo = "8",
[KPI_AfterTaxes],
IF ( _MinGrupo = "9", [KPI_Structure], _SaldosCalculados )
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)

Hello guys, 

I solved the issue doing this new measure, now all works fine, 

 

Saldo Right Amount = IF(HASONEVALUE(DIM_Cross[Group]), [/3], SUMX(VALUES(DIM_Cross[Group]), [/3]))

 

Also I got the credit from here, maybe it can help you guys in the future,

https://www.youtube.com/watch?v=ufHOOLdi_jk&app=desktop&ab_channel=Curbal

amitchandak
Super User
Super User

@uvil , please share both formula

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors