Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Extract a Single Value from a Column with Duplicates, Filtered by Another Column

Hi,   I am wrestling with what I think should be a very simple DAX measure problem, but nothing I have tried yet has worked. Here's the situation:   I have a table with colulmns [Academic Year] a...
  • Greg_Deckler's avatar
    Greg_Deckler
    6 years ago

    Looks like I left out a paren or something, try:

     

    Metric Prior Year = 
    CALCULATE (
        [Metric],
        FILTER (
            ALL ( 'dw B2 Class View' ),
            'dw B2 Class View'[Academic Year]
                = MAXX 
                   ( 
                     FILTER(
                       'dw B2 Class View', 
                       [Current Year Flag] = 1 && 
                       'dw B2 Class View'[Academic Year] IN DISTINCT ( 'dw B2 Class View'[Academic Year] )
                     ), //end second FILTER
                     [Academic Year]
                  ) //end MAXX
                  - 1
        ) // end first FILTER
    ) // end CALCULATE

     

    I also replaced VALUES with DISTINCT. I just wrote a blog article on this topic, but that wasn't because of you. https://community.powerbi.com/t5/Community-Blog/Soapbox-Series-Adding-No-VALUE-S/ba-p/1059818