Forum Discussion

mvega07's avatar
mvega07
Frequent Visitor
3 years ago
Solved

Interaction between line chart and pie chart

Hello,   I have a line graph in my report that shows the trend of sales over the last 12 months. In the same report I have a pie chart that shows the country where the sales came from, but the pie ...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi mvega07 ,

     

    You can add filters to the code instead of the visual filters. Try using this MEASURE in the pie chart.

     

    Current Month Sales =
    CALCULATE (
        SUM ( 'FactSalesTable'[Sales] ),
        'Calendar'[Year] = YEAR ( TODAY () )
            && 'Calendar'[Month Number] = MONTH ( TODAY () )
    )

    If the current month refers to the month and year of the largest date in the date table, you can use this variable instead of TODAY().

    VAR _max_date = CALCULATE(MAX('Calendar'[Date]),ALL())

     For the line chart, you can add a column to the date table.

    then add a visual filter.

    result:

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum