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 select a one date on Line chart, Table shows sum of quatities over all days and it is wrong. Is possible to see Line chart for all days and Table for the one -selected- day.
1. Default - automaticaly the select last day in the Line chart after open.
2. Allow to show quantity only for one day everytime in Table (based on the selection in Line chart)

Thank you for help

  • 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!

6 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    PetrS Would need sample data to be more specific but you can use Edit Interactions on the View menu to change the behavior of visuals interacting with one another. 

    • PetrS's avatar
      PetrS
      Frequent Visitor

       

      data

       

      correct view ... if I choose a day

       

      without selection table shows sum

      I took some screenshots. I hope it helps. I need to see quantities in Table only for one day. I don't know  ... update Table only if a one day is selected in Line chart or some conditions for Line chart selector. In the case of Stock time projection the sum is nonsense 

       

       

      • v-kelly-msft's avatar
        v-kelly-msft
        Community Support

        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!

  • PetrS's avatar
    PetrS
    Frequent Visitor

    datacorrect view ... if I choose a daywithout selection table shows sum

    I took some screenshots. I hope it helps. I need to see quantities in Table only for one day. I don't know  ... update Table only if a one day is selected in Line chart or some conditions for Line chart selector. In the case of Stock time projection the sum is nonsense 😕