Forum Discussion

Kiniaczek's avatar
Kiniaczek
Icon for Helper I rankHelper I
6 years ago

How to find Max in group without using ALLEXCEPT

Hello,

I want to find latest date for different areas.

I have table:

Date; AreaId; Other Values

When I use

newcolumn = CALCULATE(MAX(myTable[Date]);ALLEXCEPT(myTable;myTable[AreaId]))

 visual slicers don't work. I want to slice by Date on the visual. What should I use?

Regards

5 Replies

  • camargos88's avatar
    camargos88
    Icon for Community Champion rankCommunity Champion

    Hi Kiniaczek ,

     

    Are you using this code to create a column ? Try this same code with measure.

    It should work.

    • Kiniaczek's avatar
      Kiniaczek
      Icon for Helper I rankHelper I

      As I understand ALLEXCEPT and CALCULATE removes any filters from outside the query. How it can be different with measure?

      Anyway I don't want to use measure because using measures changes my table visualization from LEFTJOIN to carthesian product of columns. I was asking about it in different topic but no one replied and I focused on using columns.

      • camargos88's avatar
        camargos88
        Icon for Community Champion rankCommunity Champion

        Kiniaczek ,

         

        ALL function removes any applied filter to the table.

        ALLEXCEPT keep the filters named in the function.

         

        Also, if you want it dynamic, you need a measure. Applying it to a column will make any filter result the same returned value.

         

        Columns are generated after a refresh of your data.