Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Anonymous customers

I have a field within my data that represents a true and false value if a customer wants to be anonymous, I need an IF function that would search for the value of this field and replace the customer name to annoymous if the field is true. If not true, then leave customer name. 

 

Any help on this?

  • Anonymous 

    you can utilize a measure like this

    Measure = 
    MAXX (
        ADDCOLUMNS (
            ADDCOLUMNS (
                'Table',
                "X", SWITCH ( TRUE (), 'Table'[Condition] = TRUE (), 1, 0 )
            ),
            "change", SWITCH ( TRUE (), [X] = 1, [name], "anonymous" )
        ),
        [change]
    )

     

     

4 Replies

  • Anonymous ,

    a new column

    = if([field] = true(), "annoymous ", [Customer])

    • Anonymous's avatar
      Anonymous
      Not applicable

      It's saying that the DAX cannot values of type Text to True/False. Consider using Value or Format. 

  • smpa01's avatar
    smpa01
    Icon for Community Champion rankCommunity Champion

    Anonymous 

    you can utilize a measure like this

    Measure = 
    MAXX (
        ADDCOLUMNS (
            ADDCOLUMNS (
                'Table',
                "X", SWITCH ( TRUE (), 'Table'[Condition] = TRUE (), 1, 0 )
            ),
            "change", SWITCH ( TRUE (), [X] = 1, [name], "anonymous" )
        ),
        [change]
    )

     

     

    • smpa01's avatar
      smpa01
      Icon for Community Champion rankCommunity Champion

      Anonymous  did you try the above?