Forum Discussion

blackbool44's avatar
blackbool44
Icon for Helper I rankHelper I
6 years ago
Solved

account statement : if a text string contains keywords inside a table then input column title

Dear Power Bi Community, I am new to power Bi. Here is my issue. I have some account statement from a personnal bank account and I want to categorize the type of spending. 1: I have created a t...
  • Greg_Deckler's avatar
    Greg_Deckler
    6 years ago

    Ah, the double underscores. Well, two reasons.

    1. I think it is important to keep things that I create as variables obvious to myself. It is very easy in complex DAX calculations to start confusing yourself as to what is a column, a measure, a variable, etc. Just ensures that I don't name a variable a reserved word, etc. It's just a convention I came up with that I probably picked up from someone else or who knows. It's sort of the same reason I tend to be a stickler for capatilizing DAX functions, we all have our habits.

    2. The double underscore. It's a rhythm thing. For some reason I find it more in rhythm with my typing to do a double underscore versus a single underscore. So Shift __ is just more rhythmatic for me than Shift _, it's like I find myself pausing for a second after just doing a single underscore and then trying to type a letter but with double underscore I don't have that pause. I don't know, maybe I'm weird like that. 

     

    Let me see:

    Transaction Category = 
        VAR __Table =
            ADDCOLUMNS(
                'Table',
                "Search",FIND([Value],[Transaction Description],,-1)
            )
        VAR __Category = 
        CONCATENATEX(DISTINCT(SELECTCOLUMNS(FILTER(__Table,[Search]<>-1),"Attribute",[Attribute])),[Attribute],", ")
    RETURN
        IF(LEN(__Category)=0,"Others",__Category)