Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Date change compare based on data version

Hi All, I am very new to Power BI, but a long-time excel user.  I have spent a good deal of time reading and watching videos trying to solve what I think should be pretty straightforward, but no luc...
  • v-zhangti's avatar
    4 years ago

    Hi, Anonymous 

     

    You can try the following methods.

    New table:

    Table 2 = VALUES('Table'[Instance])

    Measure:

    StartChange = 
    VAR N1 =SELECTEDVALUE ( 'Table'[StartSchedule] )
    VAR N2 =FILTER (
            ALL ( 'Table' ),
            'Table'[ID] = MAX ( 'Table'[ID] )
                && 'Table'[Instance] IN 'Table 2'
        )
    VAR N3 =CALCULATE (
            MAX ( 'Table'[StartSchedule] ),
            TOPN (
                1,
                FILTER ( N2, [Instance] < SELECTEDVALUE ( 'Table'[Instance] ) ),
                [Instance], DESC
            )
        )
    VAR N4 =IF ( ISBLANK ( N3 ), N1, N3 )
    RETURN VALUE ( N1 - N4 )

     

    Best Regards,

    Community Support Team _Charlotte

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

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hello v-zhangti , that is great, works exactly as expected!  Is a great foundation for the problems I am looking to solve.

    Thanks!