Forum Discussion

PetrS's avatar
PetrS
Frequent Visitor
4 years ago
Solved

Line chart and Date selection

Hi all I have a source with three columns: Date, Location, Quantity. I would like to do visual with table: Location, Quantity and Line chart: Date, Quantity. It is done, it is easy. But if I don't s...
  • v-kelly-msft's avatar
    v-kelly-msft
    4 years ago

    Hi PetrS ,

     

    Create 2 measures as below:

    _quantity =
    VAR _maxdate =
        CALCULATE ( MAX ( 'Table'[date] ), ALL ( 'Table' ) )
    RETURN
        IF (
            ISFILTERED ( 'Table'[date] ),
            SUM ( 'Table'[quantity] ),
            CALCULATE (
                SUM ( 'Table'[quantity] ),
                FILTER (
                    'Table',
                    'Table'[date] = _maxdate
                        && 'Table'[location] = MAX ( 'Table'[location] )
                )
            )
        )
    
    _quantitytotal = SUMX(VALUES('Table'[location]),'Table'[_quantity])

    And you will see:

     

    For the related .pbix file,pls see attached.

     

    Best Regards,
    Kelly

    Did I answer your question? Mark my reply as a solution!