Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago

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

  • Hi Anonymous - 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!!

    • Anonymous's avatar
      Anonymous
      Not applicable

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


      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Anonymous,

        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