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
uvil
Helper I
Helper 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
Helper I
Helper 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

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.