Forum Discussion

Harinihemanth06's avatar
Harinihemanth06
Microsoft Employee
6 years ago
Solved

How to remove names from column based on condition

Class ID Question  Question order Alias Avg Sat 2 Pre 1 Hari 5 2 post  2 prem 4 2 Pre 3 Suj 5 2 post  4 Har 5 2 Pre 5 Kal 3 2 post  6 KAl 4 2 Pre ...
  • v-xuding-msft's avatar
    v-xuding-msft
    6 years ago

    Hi Harinihemanth06 ,

    We could create formulas to get the data that contains both pre and post. It is not supported to remove values with DAX. There are two ways as workarounds that you can reference.

     

    Firstly, create a column in the table.

    Column = 
    var d = CALCULATE(DISTINCTCOUNT('Table'[Question ]),ALLEXCEPT('Table','Table'[Alias]))
    return 
    IF(d>1, "True", BLANK())

    • Create a measure to implement.
    Measure = CALCULATE(MAX('Table'[Alias]),FILTER('Table','Table'[Column] = "True"))

     

    • Create a new table to implement
    Table 2 =
    SELECTCOLUMNS (
        FILTER ( 'Table', 'Table'[Column] = "True" ),
        "Class ID", 'Table'[Class ID],
        "Question", 'Table'[Question ],
        "Question Order", 'Table'[Question order],
        "Alias", 'Table'[Alias],
        "Avg sat", 'Table'[Avg Sat]
    )
    

    Best Regards,

    Xue Ding

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.