Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Create Table based on IF statement

I have a simple job table with 3 columns, job_ID(pk), date_updated, updated_by(user)   A job can be updated several times by both a user and the system so its common to see multiple entries for one...
  • Mikelytics's avatar
    Mikelytics
    3 years ago

    Hi Anonymous 

     

    Please try the following:

     

    my example (TableName = SampleJob)

     

    Formula:

    SampleJob Summarized = 
    
    SUMMARIZE(
        SampleJob,
        [JobID],
        "MaxDate",MAX(SampleJob[Date]),
        "Last Non System User",
            var __maxDate = MAX(SampleJob[Date])
            var __LastNonSystemUser =
                CALCULATE(
                    LASTNONBLANK(SampleJob[Allocated],TRUE()),
                    SampleJob[Date]=__maxDate && SampleJob[Allocated] <> "CIVICAAMW"
                )
            Return
            IF(ISBLANK(__LastNonSystemUser),"CIVICAAMW",__LastNonSystemUser)
    )

     

    Result:

     

    I think the only question is how to handle if you have two updates ion same date. BUt this is hard to specify.

     

    Best regards
    Michael
    -----------------------------------------------------
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    Appreciate your thumbs up!
    @ me in replies or I'll lose your thread.