hi all
im using power pivot and i have this code:
=IF(CALCULATE(SUM(TAB_VALORES[EVENTO VALOR]);TAB_EVENTOS[IRRF INCIDÊNCIA CÓDIGO]=11;TAB_EVENTOS[EVENTO TIPO]="V")-CALCULATE(SUM(TAB_VALORES[EVENTO VALOR]);TAB_EVENTOS[IRRF INCIDÊNCIA CÓDIGO]=11;TAB_EVENTOS[EVENTO TIPO]="D")<0;0;(CALCULATE(SUM(TAB_VALORES[EVENTO VALOR]);TAB_EVENTOS[IRRF INCIDÊNCIA CÓDIGO]=11;TAB_EVENTOS[EVENTO TIPO]="V")-CALCULATE(SUM(TAB_VALORES[EVENTO VALOR]);TAB_EVENTOS[IRRF INCIDÊNCIA CÓDIGO]=11;TAB_EVENTOS[EVENTO TIPO]="D")))
what i wanna do is, if in a month the value is negative then the value must be changed to zero(the group is the entire month), the result by month its ok when its displayed in a pivot table, but the negative value of a particular month the was changed to zero is affecting the total sum, the total sum in this case should be 12.211,98 but pivot table its showing 11.960,82, in October the negative value was -251,16
V is for plus and D is for minus, dont worry, Brazilian things
im new in DAX, if there is a way to reduce the formula i accept suggestions
below the values as pivot table displays, but total sum in pivot table its not right
jan 1.749,57
fev 1.048,41
mar 421,56
abr 314,96
mai 314,96
jun 1.611,60
jul 1.276,02
ago 714,33
set 1.505,93
out 0,00
nov 1.643,95
dez 1.610,69
negative value from totals sum
Re: negative value from totals sum
Not exactly sure what you are asking, maybe try to supply "SIMPLE" spreadsheet to help .
best guess.
see attached
mTotal:=var x = SUM(Table1[value])+0
return IF(x<0,0,x)
best guess.
see attached
mTotal:=var x = SUM(Table1[value])+0
return IF(x<0,0,x)
- Attachments
-
- xxx.xlsx
- (99.85 KiB) Downloaded 6 times
Re: negative value from totals sum
found it, new code is below for anyone interested
=sumx(SUMMARIZE(TAB_VALORES;[INSS CHAVE];[CPF];"TAB_I_T_B_F";CALCULATE(
SUM(
TAB_VALORES[EVENTO VALOR]);
TAB_EVENTOS[IRRF INCIDÊNCIA CÓDIGO]=13;
TAB_EVENTOS[EVENTO TIPO]="V")-
CALCULATE(
SUM(
TAB_VALORES[EVENTO VALOR]);
TAB_EVENTOS[IRRF INCIDÊNCIA CÓDIGO]=13;
TAB_EVENTOS[EVENTO TIPO]="D"));if([TAB_I_T_B_F]<0;0;[TAB_I_T_B_F]))
=sumx(SUMMARIZE(TAB_VALORES;[INSS CHAVE];[CPF];"TAB_I_T_B_F";CALCULATE(
SUM(
TAB_VALORES[EVENTO VALOR]);
TAB_EVENTOS[IRRF INCIDÊNCIA CÓDIGO]=13;
TAB_EVENTOS[EVENTO TIPO]="V")-
CALCULATE(
SUM(
TAB_VALORES[EVENTO VALOR]);
TAB_EVENTOS[IRRF INCIDÊNCIA CÓDIGO]=13;
TAB_EVENTOS[EVENTO TIPO]="D"));if([TAB_I_T_B_F]<0;0;[TAB_I_T_B_F]))
Who is online
Users browsing this forum: No registered users and 6 guests


