Forum Discussion

nogstavo's avatar
nogstavo
Frequent Visitor
3 years ago

Iteration Troubles

Hello!

 

I've been having trouble with the iteration and subtotal context of my visual.

Objective: When a singular SKU filter is selected from the user, show the values within the context of the selected SKU.

Here, for instance, as we can see in the Total Quantidades Vendidas there are different subtotals above the cost center code, when they should all display 6.248,00 since I have selected only one SKU (166072).

 

I have 5 dimensions as indexes.

 

In the Quantidades Vendidas (Sold Quantities) we have the correct output when filtering;

Total Quantidades Vendidas (Total Sold Quantities) should bring the totals of quantities sold within the Cost Center Code... As we can see, this is happening but not on the totals.

Quantidades Vendidas

 

Quantidades Vendidas = 
VAR Data = SELECTEDVALUE(dCalendario[Mês/Ano])

VAR Result =

CALCULATE( 
  SUM(factKE30[Quantidade Total]),  factKE30[Rateio] = "Rateio", dCalendario[Mês/Ano] = Data,
  ALLCROSSFILTERED(factKE30),
  TREATAS(VALUES(dimProdutos[SKU]), factKE30[Artigo])
)

RETURN Result

 

 

Total Quantidades Vendidas

 

Total Quantidades Vendidas = 

VAR Total =

CALCULATE( 
 [Quantidades Vendidas]
 ,ALL(dimProdutos[SKU])

)

RETURN Total

 

 

I've tried to iterate the Total Quantidades Vendidas:

 

Total quantidades vendidas II = 

IF (
    ISINSCOPE(dimProdutos[SKU]),
    [Total Quantidades Vendidas],
    SUMX(SUMMARIZE(dimProdutos, [SKU],"__Value", [Total Quantidades Vendidas]), [__Value])
)

 

 

But with no success and I've tried other strategies also.

 

Thank you in advance.

3 Replies