Skip to main content
cancel
Showing results for 
Search instead 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

Reply
thatjoey20
Helper I
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 Almoxarifado],
'fEstoque Lancamento'[Cod Produto],
"UltimoSeq", MAX('fEstoque Lancamento'[Nr Sequencia])
)

VAR EstoqueTotal =
SUMX(
UltimasSequencias,
VAR CodEmpresa = [Cod Empresa]
VAR CodAlmoxarifado = [Cod Almoxarifado]
VAR CodProduto = [Cod Produto]
VAR UltimaSequencia = [UltimoSeq]
RETURN
CALCULATE(
MAX('fEstoque Lancamento'[Qtd Total]),
'fEstoque Lancamento'[Cod Empresa] = CodEmpresa,
'fEstoque Lancamento'[Cod Almoxarifado] = CodAlmoxarifado,
'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
rajendraongole1
Community Champion
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 Almoxarifado],
'fEstoque Lancamento'[Cod Produto],
"UltimoSeq",
CALCULATE(
MAX('fEstoque Lancamento'[Nr Sequencia]),
REMOVEFILTERS('fCalendário')
)
)

VAR EstoqueTotal =
SUMX(
UltimasSequencias,
VAR CodEmpresa = [Cod Empresa]
VAR CodAlmoxarifado = [Cod Almoxarifado]
VAR CodProduto = [Cod Produto]
VAR UltimaSequencia = [UltimoSeq]
RETURN
CALCULATE(
MAX('fEstoque Lancamento'[Qtd Total]),
'fEstoque Lancamento'[Cod Empresa] = CodEmpresa,
'fEstoque Lancamento'[Cod Almoxarifado] = CodAlmoxarifado,
'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!
Appreciate your Kudos!!

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


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.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

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

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

July Newsletter

Fabric Community Update - July 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors