Forum Discussion

alee5210's avatar
alee5210
Helper II
2 years ago
Solved

Make Chart Using Latest ID Based On User Selected Date

Hi Everyone, I have a tricky question. I am looking to create a chart which shows which courier carried the most.   To explain how the data works, in the main table below we have a Parcel ID and t...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi alee5210 

     

    Please try this:

    First of all, I create a measure:

    Effective =
    VAR _currentDate =
        MAX ( 'Table'[Effective Start Date] )
    VAR _currentCountier =
        SELECTEDVALUE ( 'Table'[Courier] )
    VAR _currentID =
        MAX ( 'Table'[Parcel ID] )
    VAR _vtable =
        FILTER (
            ADDCOLUMNS (
                ALLSELECTED ( 'Table' ),
                "_Maxdate",
                    MAXX (
                        FILTER (
                            ALLSELECTED ( 'Table' ),
                            [Parcel ID] = EARLIER ( 'Table'[Parcel ID] )
                                && [Courier] = EARLIER ( 'Table'[Courier] )
                        ),
                        [Effective Start Date]
                    )
            ),
            [Effective Start Date] = [_Maxdate]
        )
    RETURN
        SUMX ( FILTER ( _vtable, [Courier] = MAX ( 'Table'[Courier] ) ), [Mass] )
    

    The result is as follow:

     

     

    Best Regards

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