Forum Discussion

CarlsBerg999's avatar
CarlsBerg999
Helper V
4 years ago
Solved

Calculated column (CALCULATE + FILTER) from the same table

Hi,    I'm trying to create a calculated column that returns for values based on two adjacent columns in the same table. For some reason, the value that is returned is not correct. I think this mig...
  • SpartaBI's avatar
    SpartaBI
    4 years ago

    CarlsBerg999 so yes, it's because of your max you did in the beginning. I suspected right 🙂
    Try this:

     

    Project ID =
    VAR CurrentRowSO = 'Sales'[Sales Order ID]
    VAR Task_ID = MAXX(FILTER('Sales', 'Sales'[Sales Order ID] = CurrentRowSO), 'Sales'[Task ID])
    
    RETURN
        CALCULATE (
            LEFT (
                Task_ID,
                LEN ( Task_ID )
                    - (
                        LEN ( Task_ID ) - FIND ( "-", Task_ID ) + 1
                    )
            ),
            'Sales'[Task ID] <> BLANK (),
            'Sales'[Sales Order ID] = CurrentRowSO
        )

     







          

    Showcase Report – Contoso By SpartaBI