Forum Discussion

sudhakar111's avatar
sudhakar111
Helper IV
3 years ago
Solved

Line Chart with Slider selection

Hello All,

 

Below is my issue, any help is appreciated.

 

There are 2 tables one is the Calendar table and other is Invoice table.

 

Both are linked using the Date field in Calendar table and Invoice billed date in Invoice table.

 

The report has a year filter using a slider to select the years which is based on year field in Calendar table.

 

To capture the Max and Min years i am using the below measures.

 

MAX_YEAR = CALCULATE(MAX('Calendar'[Year]),ALLSELECTED('Calendar'[Year]))

 

MIN_YEAR = CALCULATE(MIN('Calendar'[Year]),ALLSELECTED('Calendar'[Year]))

 

We want to see the Invoice Billed Quantity along with the month name in a line chart.

 

One line should show the billed quantity based on the maximum selected year on the year slider and other line should show the billed quantity based on minimum year on the year slider.

 

Below are the formula for the Max and Min lines.

 

MAX_QTY = calculate(sum(INVOICE[BILLED_QTY]),filter(INVOICE,max('INVOICE'[Year])=[MAX_YEAR]))

 

MIN_QTY = calculate(sum(INVOICE[BILLED_QTY]),filter(INVOICE,min('INVOICE'[Year])=[MIN_YEAR]))

 

I am using the above 2 measures and month name in the line chart.

 

So based on the slider selection if the year is 2023, the MAX_QTY field is bringing information for 2023 and 2022 as well.

 

Each line should display quantities for the selected years only.

 

8 Replies