Forum Discussion

GiTchitchinadze's avatar
GiTchitchinadze
Frequent Visitor
3 years ago
Solved

Selected Year Side By Side Comparison In chart

Hi guys,

 

I want to create a bar chart or any other chart that will include loss ratio data from two selected years. (for example, if i choose 2020 and 2022 it has to show both of them side by side). The problem is when I create a single date slicer and choose both years there's no side by side comparison, it's just a dynamic visualization of it (as first screenshot shows).Capture1

 

I want them to be side by side like next to 2019 qtr1 has to be second chosen year's first quarter results like its on the second screnshot. Loss ratio means Loss Amount divided by Sales Amount.

  • Hi GiTchitchinadze ,

     

    If you want the chart to display selected years side by side, you need to change your X-axis(remove year from the date hierarchy)

    Based on your description, I have created a simple sample:

    Please try:

    Loss Ratio = DIVIDE(SUM('Table'[Loss Ammount]),SUM('Table'[Sales Ammount])) 

    Apply it to the visual:

    Then create a slicer for year:

    Final output:

    Best Regards,

    Jianbo Li

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

2 Replies

  • GiTchitchinadze , Try a trailing year measure with Date Table

     

    Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
    Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),SAMEPERIODLASTYEAR('Date'[Date]))

     

    or

    Last year same QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(dateadd('Date'[Date],-1,Year)))

     

    Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
    https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5bd4
    To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

  • Hi GiTchitchinadze ,

     

    If you want the chart to display selected years side by side, you need to change your X-axis(remove year from the date hierarchy)

    Based on your description, I have created a simple sample:

    Please try:

    Loss Ratio = DIVIDE(SUM('Table'[Loss Ammount]),SUM('Table'[Sales Ammount])) 

    Apply it to the visual:

    Then create a slicer for year:

    Final output:

    Best Regards,

    Jianbo Li

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