Forum Discussion

diegojustino's avatar
diegojustino
Frequent Visitor
9 years ago
Solved

New column flagged as first entry, second entry, or other.

Hi,   I have a table where I need to create a column that should signal if it is the first, second or other entries, according to some parameters.   Example: I want to see the first date of the ...
  • v-ljerr-msft's avatar
    9 years ago

    Hi diegojustino,

     

    According to your description, you should be able to use RANK.EQ Function (DAX) to create a calculate column to flag the entries in this scenario.

     

    I assume you have a table called "Table1" like below.

     

     

    1. Use the formula below to create a calculate column to get the number indicating which entry it should be.

     

    Entry1 = 
    VAR r = Table1[RO number]
    VAR c = Table1[Claim]
    VAR p = Table1[Performed]
    RETURN
        IF (
            p = "Reparo",
            CALCULATE (
                RANK.EQ ( c, Table1[Claim], ASC ),
                FILTER ( ALL ( Table1 ), Table1[RO number] = r && Table1[Performed] = p )
            )
        )

     

     

    2. Then use the formula below to flag the entry.

    Entry2 = 
    IF (
        Table1[Entry1] = 1,
        "First Entry",
        IF (
            Table1[Entry1] = 2,
            "Second Entry",
            IF ( Table1[Entry1] >= 3, "Third Entry or More" )
        )
    )

     

    Regards