Search code examples
powerbidax

Pulling date info out of a slightly odd named column and splitting the date into two new columns


I import a new csv every month from a phone support platform that has prebuilt reports that I cannot alter. What I need to do is grab the year and month from a column, then create a new column for the year and another for the month, but with the month fully spelled out.

I've tried playing with Trim and Format but cannot figure this out.

Column in question


Solution

  • pls see if this is what you want

    year =
    VAR _p =
        FIND ( "-", [Column1], 1, 0 )
    RETURN
        MID ( 'Table'[Column1], _p - 4, 4 )
    
    month =
    VAR _p =
        FIND ( "-", [Column1], 1, 0 )
    RETURN
        FORMAT (
            DATE ( MID ( 'Table'[Column1], _p - 4, 4 ), MID ( [Column1], _p + 1, 2 ), 1 ),
            "mmmm"
        )
    

    enter image description here