Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
GrimReaperX
Helper II
Helper II

Total count for next years

Hello,

 

I would like to show Total Count for the next 5 years from today when I select certain year in the year slicer. It will be dynamic and If i select year 2024 it should show total count for next 5 years starting from 2024. If i do not select any date, it should show total count for next 5 years from today.

I tried some formulas however result was same as the total count.

 

Thank you very much in advance

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @GrimReaperX 

You can refer to the following example.

The slicer table

vxinruzhumsft_0-1683526095411.png

 

The data table

vxinruzhumsft_1-1683526105538.png

 

Create a measure

Measure = IF(ISFILTERED('Table (2)'[Column1]),CALCULATE(SUM('Table'[Column2]),FILTER('Table','Table'[Column1]>SELECTEDVALUE('Table (2)'[Column1])&&'Table'[Column1]<=SELECTEDVALUE('Table (2)'[Column1])+5)),CALCULATE(SUM('Table'[Column2]),FILTER('Table','Table'[Column1]>YEAR(TODAY())&&'Table'[Column1]<=YEAR(TODAY())+5)))

Then put the column of slicer table to the slicer and create a table visual and put the data of data table and measure  to the visual.

Output

When the silicer is not chosen.

vxinruzhumsft_2-1683526233949.png

 

When the slicer is chosen

vxinruzhumsft_3-1683526249762.png

Best Regards!

Yolo Zhu

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

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @GrimReaperX 

You can refer to the following example.

The slicer table

vxinruzhumsft_0-1683526095411.png

 

The data table

vxinruzhumsft_1-1683526105538.png

 

Create a measure

Measure = IF(ISFILTERED('Table (2)'[Column1]),CALCULATE(SUM('Table'[Column2]),FILTER('Table','Table'[Column1]>SELECTEDVALUE('Table (2)'[Column1])&&'Table'[Column1]<=SELECTEDVALUE('Table (2)'[Column1])+5)),CALCULATE(SUM('Table'[Column2]),FILTER('Table','Table'[Column1]>YEAR(TODAY())&&'Table'[Column1]<=YEAR(TODAY())+5)))

Then put the column of slicer table to the slicer and create a table visual and put the data of data table and measure  to the visual.

Output

When the silicer is not chosen.

vxinruzhumsft_2-1683526233949.png

 

When the slicer is chosen

vxinruzhumsft_3-1683526249762.png

Best Regards!

Yolo Zhu

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

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.