Forum Discussion

Shloka_Lakhani's avatar
Shloka_Lakhani
Frequent Visitor
3 years ago

Create comparison chart using two Date Slicer in single Line Chart

Compare two custom date slicers into a single visual for line chart. 

 

Also tried as below steps:

1) Created two Date slicer for Comparision Date and Custom Date.

2) Overlapped two line charts in the below screenshot.
3) Gave interaction to the respected line charts. So while selecting Dates from Comparison Date slicer only the Red line chart will be synchronised. And same way while selecting Dates from Date Slicer only the Blue line chart will be synchronised.

 

Now, we want to show tooltip for the both lines at same point on hover.

 

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Shloka_Lakhani ,

     

    Power BI only support us to show tooltips from one visual. As far as I know, you don't need to overlap two line charts to achieve your goal. Here Iauggest you to calculate two lined by measures and create two unrelated date tables for slicer.

    Line 1 =
    VAR _SelectDate =
        VALUES ( 'Date'[Date] )
    RETURN
        CALCULATE (
            SUM ( 'TableName'[Value] ),
            FILTER ( 'TableName', 'TableName'[Date] IN _SelectDate )
        )
    Line 2 =
    VAR _SelectDate =
        VALUES ( 'Comparison Date'[Date] )
    RETURN
        CALCULATE (
            SUM ( 'TableName'[Value] ),
            FILTER ( 'TableName', 'TableName'[Date] IN _SelectDate )
        )

    Add these measures into Y axis and then you can see tooltips at the same time.

     

    Best Regards,
    Rico Zhou

     

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

     

  •  Hi Anonymous, 

    Thanks for quick response.  

      

    We want to achieve below in Power BI  

    Dark Blue Line : Represents Nov Month Data  

    Light Blue Line : Represents Oct Month Data  

      

    Range we can compare : Pre. Month  

    Pre Year  

    Pre Quarter 

    Last 7 Days  and custom date 

     

     

    Solution you have provided is giving continue line for both the period instead of overlapping lines for both periods we are trying to compare. Please find the chart below based on your solution. 

     

     

     

     

    If you can help us with the solution where we can compare the two custom periods on a line chart. 

    Please find attached sample data set below: