Forum Discussion

powerbi_enthu's avatar
powerbi_enthu
Regular Visitor
4 years ago
Solved

Power BI DAX query

Hi Folks,   I want to manipulate my column value to get it into new column: Below is my data. I need to create "event end date" column with end date as 1 day prior to next event's start date with...
  • v-henryk-mstf's avatar
    4 years ago

    Hi powerbi_enthu ,

     

    According to my test, I need to first extract the event group field in power query as the basis for grouping, and then sort the group. Then create the following dax formula in desktop with the following reference:

    Column =
    RANKX (
        FILTER ( ALL ( 'Table' ), 'Table'[Group] = EARLIER ( 'Table'[Group] ) ),
        'Table'[event start date],
        ,
        ASC,
        DENSE
    )
    Col_result = 
    VAR cur_index = 'Table'[Column] + 1
    RETURN
        IF (
            'Table'[Column] = 4,
            TODAY (),
            CALCULATE (
                MAX ( 'Table'[event start date] ) - 1,
                FILTER (
                    ALL ( 'Table' ),
                    'Table'[Column] = cur_index
                        && 'Table'[Group] = EARLIER ( 'Table'[Group] )
                )
            )
        )


    If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


    Best Regards,
    Henry


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