Forum Discussion

devika's avatar
devika
Icon for Helper II rankHelper II
2 years ago

slicer - Line chart with selected value and overall value

Hi

 

Thanks for your time.

 

I'm creating a line graph showing the total sales and also by region in the same graph.

  • Total sales by year should always be displayed.
  • When a user doesn't select any region, only show the total by year.
  • When a user select a region/regions,show the regions as a separate line and overall total(all the regions total not only selected regions total).
  • Don't show "total" as an option in the slicer.

 

Any advice is much appreciated.

 

Year

RegionSales
2018A100
2018B200
2018C300
2019A400
2019B500
2019C600
2020A700
2020B800

 

 

 

3 Replies

  • Hi devika ,

     

    Please create the two below-mentioned measurements and add them to your line chart.

    1. Total Sales = SUM('Table'[Sales])
     
    2. Total Sales Selected =
    IF (
        ISFILTERED('Table'[Region]),
        CALCULATE(SUM('Table'[Sales]), ALL('Table')),
        SUM('Table'[Sales])
    )
     
    While select value in the filter it show both total and selected region 

     

     when nothing is selected it shows the total value only

     

    If this post helps, then please consider Accept it as the solution 

    Thanks,

    Hari

     

    • devika's avatar
      devika
      Icon for Helper II rankHelper II

      Shreeram04 - Thanks for your time.sorry not really,

        1. I need to show 600,1500,1500 for total by year (always)

       2.  If region A is selected then 100,400,700 ( as a single line for Region A by Year)

      3.   If region A and B are selected then 100,400,700 ( as a single line for Region A by Year )  200,500,800 (as a single line for Region B by Year)

       

      • devika's avatar
        devika
        Icon for Helper II rankHelper II

        Hi - I am taking a step back to show the grand total and just changed the slicer to single select, so it is working fine in this case.

        Can anyone please advise if multiselection in the slicer is possible and also show the regions and  lines/plots separately ?

        I have seen the post to create parameter but this won't work in the scenario as I need to produce three different graphs - Profit, Loss, Sales interacting to one Region slicer

         Measures: (similarly created for Profit)

         

        Total_Loss_line = CALCULATE(sum('Table'[Loss]),All('Table'[Region]))
         
        Total_Loss_Selected =
        IF (
            ISFILTERED('Table'[Region]),
            CALCULATE(SUM('Table'[Loss])),
            SUM('Table'[Loss])
        )