Forum Discussion

daveghowes's avatar
daveghowes
Frequent Visitor
4 years ago
Solved

Calculated Column returns Null value or not all values

I am stuck trying to get a calculated column working in PBI, if i try to - or + the results it returns some values but if i dont - or + it returns the value on that row. Long and short of it I am try...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi  ,

    I created a sample pbix file(see attachment) for you, please check whether that is what you want. You can update the formula of the calculated column as below:

    Column_NextDate = 
    CALCULATE (
        MAX ( 'Case Workgroup Assignement History (USE)'[Created_Date] ),
        FILTER (
            'Case Workgroup Assignement History (USE)',
            'Case Workgroup Assignement History (USE)'[Index]
                = EARLIER ( 'Case Workgroup Assignement History (USE)'[Index] ) + 1
        )
    )

    Or you can create a meausre as below to get it:

    NextDate = 
    VAR _selindex =
        SELECTEDVALUE ( 'Case Workgroup Assignement History (USE)'[Index] )
    VAR _preindex =
        CALCULATE (
            MIN ( 'Case Workgroup Assignement History (USE)'[Index] ),
            FILTER (
                ALLSELECTED ( 'Case Workgroup Assignement History (USE)' ),
                'Case Workgroup Assignement History (USE)'[Index] > _selindex
            )
        )
    RETURN
        CALCULATE (
            MAX ( 'Case Workgroup Assignement History (USE)'[Created_Date] ),
            FILTER (
                ALLSELECTED ( 'Case Workgroup Assignement History (USE)' ),
                'Case Workgroup Assignement History (USE)'[Index] = _preindex
            )
        )

    If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

    How to upload PBI in Community

    Best Regards