Forum Discussion

asjones's avatar
asjones
Icon for Helper V rankHelper V
2 years ago

DAX - All() Not working when FILTER() also used

I have the following DAX code that is close, but the ALL() is not removing the filters on Period_GL.

    CALCULATE (
        [LOA - Original Budget - NO IDC CO-DO]
        , ALL( Period_GL )
        , Filter( 'Main Project Master File - PMF' , [Main Project Active] = 1 )
    )
 
If I remove the FILTER() then the code with the ALL() works
 CALCULATE (
        [LOA - Original Budget - NO IDC CO-DO],
                    ALL ( Period_GL )
        )
I don't like the FILTER() in the calculate, but ran into errors when I did not have that and needed a dynamic check for "active".
 
Any ideas or suggestions? Love to hear differnet thoughts.
 
thanks
 
Alan
 

6 Replies

  • asjones can you share the relationship diagram, and also the measure definition?  Also, it will good to know what is not working, and some sort of screenshots explaining the problem.

  • parry2k 

    Great question, I was focusted on the FILTER() and did not look closer. For  a quick test I changed the FILTER() line to

    , Filter( 'Main Project Master File - PMF' , 1= 1 )
    and my results were correct.... the ALL() removed the slicers I had on the page.
     
    The measure Main Project Actiive is this... (it is ugly, but we have screwy data).
    Main Project Active =
    VAR __Period_Selected = SELECTEDVALUE ( Period_GL[Period] )
    VAR __FY_Year_of_Perid_Selected = LEFT ( __Period_Selected, 4 )
    VAR __Period_Begining_of_FY = VALUE ( __FY_Year_of_Perid_Selected & "00" )
    VAR __Period_End_of_FY = VALUE ( __FY_Year_of_Perid_Selected & "13" )

    RETURN
    if( CALCULATE( [Programmatic Actuals (with IDC)] + [Prog Working Bud Select FY no IDC]  +  [Board Budget (USD)] + [LOA - Original Budget with IDC CO-DO] ,
            ALL ( Period_GL ),
             __Period_Begining_of_FY <= Period_GL[Period]
              && __Period_End_of_FY >= Period_GL[Period]
        ) <> 0  , 1 , 0)
     
     
    • asjones's avatar
      asjones
      Icon for Helper V rankHelper V

      parry2ksorry for the confusion... it is not working I did 1=1 as a test only, but i need the filter [Main Project Active] = 1  in three like the oringal example.

      i pasted what the measure was so you could see it.

       

  • asjones I think you need to read my previous reply and answer the questions if you need help.

    • asjones's avatar
      asjones
      Icon for Helper V rankHelper V

      i thought i had posted enough, but realize my question is still confusing ... i will pull my question and try and repost it with more details. I was worried all the details would make it more confusing and people would not read it.

       

      thanks for trying