Forum Discussion

Paramjit's avatar
Paramjit
Icon for Helper II rankHelper II
4 years ago
Solved

column with Maximum value with filter condition

Hi Team,

 

I have two columns ID and Actual Start Date in direct query. 

I need another column to get the maximum of Actual Start date where ID = 1000

 

IDActual Start date
10001-Jan-21
20002-Jan-21
300003-Jan-21
40004-Jan-21
10003-Jan-21

 

IDActual Start dateMax
10001-Jan-213-Jan-21
20002-Jan-213-Jan-21
300003-Jan-213-Jan-21
40004-Jan-213-Jan-21
10003-Jan-213-Jan-21

 

i am trying with MAXX and filter but it is removing the rows.

 

Please help.

 

SivaMani 

amitchandak 

Anonymous 

 

Thank you.

Paramjit

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Paramjit ,

    Since you are using Direct Query mode to connect to the data source, you cannot create a custom column. This is a limitation of Direct Query connection mode. You can review this official documentation below for more details.

    Limited data transformations

    There are also restrictions on creating calculated column as follows:

    Modeling limitations

    You can create a measure as suggested by amitchandak :

    Measure = MAXX(FILTER(ALLSELECTED('Table'),'Table'[ID]="1000"),[Actual Start date])

    Best Regards

7 Replies

  • Paramjit , Try measure like

     

    maxx(filter(allselected(Table[ID]), Table[ID] =1000), Table[Actual Start date])

     

    or

     

    calculate(max(Table[Actual Start date]), filter(allselected(Table[ID]), Table[ID] =1000 ))

     

    or

    calculate(max(Table[Actual Start date]), filter(all(Table[ID]), Table[ID] =1000 ))

    • Paramjit's avatar
      Paramjit
      Icon for Helper II rankHelper II

      Hi amitchandak 

       

      All the below three measures are not working. 

       

      Actual start date is not find.

      Maxx(filter(allselected(Table[ID]), Table[ID] =1000), Table[Actual Start date])

       

      or It is returing only rows where ID=1000

      calculate(max(Table[Actual Start date]), filter(allselected(Table[ID]), Table[ID] =1000 ))

       

      or it is returing rows where ID=1000

      calculate(max(Table[Actual Start date]), filter(all(Table[ID]), Table[ID] =1000 ))

       

      Thank you,

      Paramjit

      • amitchandak's avatar
        amitchandak
        Icon for Super User rankSuper User

        Paramjit , I tried these two seem to be working

        Measure = CALCULATE(max(ID1000[Actual Start date]), ID1000[ID]=1000)
        Measure 2 = CALCULATE(max(ID1000[Actual Start date]), filter(all(ID1000[ID]), ID1000[ID]=1000))

         

        file attached after signatures