Forum Discussion

lucbc's avatar
lucbc
Regular Visitor
3 years ago
Solved

Measure and line filter

Hi everyone, i'm new as a Power BI user, so i want you help with this issue:

 

I work at a company that has a campaign happening, which give R$ 1,00 for each product if you sell more than 100 units in the same fiscal note from a specific product, and if you sell any quantity below that, you get R$ 0,50. With that in mind, here is what my report looks like:

It's Name, Quantity of Fiscal note, OLT( Another campaign), Amount of P20( the campaign that i need help), and the last column is the one that is suppose to give me how much money i have to pay. If you look at the lines, the name Thainá P. have 2 sales,  and it makes the right calculations, but when it sums, for some reason, becomes 101, instead of 100,50, and this is a line subtotal. I'll post the P20 column measure, that is for the amount sold, and the last one, that is the one which does the calculation.

P20:

Qtde_P20 = CALCULATE([Qtde Fat], FILTER(ALL(Produtos), (Produtos[Código]Table with the product code) IN {("50010016")}))

Resultado_Geral:
Resultado_Geral= IF(CALCULATE(1,SF2010[Combo]Column to see if there is an OLT+P20 in the same fiscal note= 1) = 1, IF([Qtde Fat] > 99, [Calculo_P20]*2 + [Calculo_OLT],[Calculo_P20]+[Calculo_OLT]), [Calculo_P20] * 2 + [Calculo_OLT] )

Calculo_P20 = CALCULATE([Qtde Fat] * 0.5, FILTER(ALL(Produtos), (Produtos[Código]) IN {("50010016")}))
Calculo_OLT = CALCULATE([Qtde Fat] * 100, FILTER(ALL(Produtos), (Produtos[Código]) IN {("50010014"),("50010017"),("50010001")}))

Qtde Fat = SUM(SD2010[D2_QUANT])

 

1 Reply