cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Helper I

## CANT REMOVER FILTERS FROM A MEASURE

Hello guys, I am a trouble with my measure , I simply can't get the value of the whole period using the function ALL, because even if I use it, when I filter the slicer, it keeps filtering the date. How Can I solve this?

This measure brings me the value of stock, based on the last sequence of all products, different stocks and companies.

03M - Estoque Total =
VAR UltimasSequencias =
SUMMARIZE(
'fEstoque Lancamento',
'fEstoque Lancamento'[Cod Empresa],
'fEstoque Lancamento'[Cod Produto],
"UltimoSeq", MAX('fEstoque Lancamento'[Nr Sequencia])
)

VAR EstoqueTotal =
SUMX(
UltimasSequencias,
VAR CodEmpresa = [Cod Empresa]
VAR CodProduto = [Cod Produto]
VAR UltimaSequencia = [UltimoSeq]
RETURN
CALCULATE(
MAX('fEstoque Lancamento'[Qtd Total]),
'fEstoque Lancamento'[Cod Empresa] = CodEmpresa,
'fEstoque Lancamento'[Cod Produto] = CodProduto,
'fEstoque Lancamento'[Nr Sequencia] = UltimaSequencia,
ALL('fCalendário'[Date])    --- I TRIED USING ALL, ALLEXCEPT, REMOVEFILTERS, BUT NOTHING HAS CHANGED.
)
)

RETURN EstoqueTotal

3 REPLIES 3
Community Champion

Hi @thatjoey20 - The issue arises because filter with removal functions are being applied inside the calculate statement, which might not remove filters,

Can you try the below measure

03M - Estoque Total =
VAR UltimasSequencias =
SUMMARIZE(
'fEstoque Lancamento',
'fEstoque Lancamento'[Cod Empresa],
'fEstoque Lancamento'[Cod Produto],
"UltimoSeq",
CALCULATE(
MAX('fEstoque Lancamento'[Nr Sequencia]),
REMOVEFILTERS('fCalendário')
)
)

VAR EstoqueTotal =
SUMX(
UltimasSequencias,
VAR CodEmpresa = [Cod Empresa]
VAR CodProduto = [Cod Produto]
VAR UltimaSequencia = [UltimoSeq]
RETURN
CALCULATE(
MAX('fEstoque Lancamento'[Qtd Total]),
'fEstoque Lancamento'[Cod Empresa] = CodEmpresa,
'fEstoque Lancamento'[Cod Produto] = CodProduto,
'fEstoque Lancamento'[Nr Sequencia] = UltimaSequencia,
REMOVEFILTERS('fCalendário')
)
)

RETURN EstoqueTotal

I think it works changes mentioned in highlighted color

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Helper I

hEY @rajendraongole1 , thanks for your support, but still didnt work. How can I share my file here?

Community Support

Hi @thatjoey20,

You can create some dummy data and paste to your thread with table format or upload the sample data to a network driver and share the link here.

Notice: remove sensitive data before share.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.