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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
henry24007
Helper I
Helper I

slicer problem

 

I have a  year slicer for controling matrix 1, and start year and end year slicer for controlling matrix 2 which is used to calculate the difference of the selected year. My question is how can I use the start year and end year slicer to control the matrix 1 instead of using the year slicer or vice versa?

 

henry24007_0-1658125818232.png

 

Below is the measure of matrix 2 or start/end year:

 

diff =
var start_year = SELECTEDVALUE('Start Year'[year])
var end_year = SELECTEDVALUE('End Year'[year])

RETURN
IF( end_year - start_year < 0, "Invalid Selection",
CALCULATE(SUM(Score[Value]),Score[Year] == start_year) -
CALCULATE(SUM(Score[Value]),Score[Year] == end_year)
)
 
 
 
Start Year = ALLNOBLANKROW('year'[year])
 
 
End Year = ALLNOBLANKROW('year'[year])
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@henry24007 , I have discussed it in this video

Select data between months - https://youtu.be/nEt7dT3Tfv4

 

Date Range Using 2 slicer =
var _max = minx(allselected(Date1), Date1[year])
var _min = maxx(allselected(Date2), Date2[year])
return
calculate(countrows(Table), Filter(Table,year(Table[Date]) <=_max && Year(Table[Year]) >=_min) )

 

or

 

Date diff  =
var _max = minx(allselected(Date1), Date1[year])
var _min = maxx(allselected(Date2), Date2[year])
return
calculate(countrows(Table), Filter(Table,year(Table[Date]) =_max))- calculate(countrows(Table), Filter(Table,   Year(Table[Year]) >=_min) )

 

For second code

How to use two Date/Period slicers

https://youtu.be/WSeZr_-MiTg

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@henry24007 , I have discussed it in this video

Select data between months - https://youtu.be/nEt7dT3Tfv4

 

Date Range Using 2 slicer =
var _max = minx(allselected(Date1), Date1[year])
var _min = maxx(allselected(Date2), Date2[year])
return
calculate(countrows(Table), Filter(Table,year(Table[Date]) <=_max && Year(Table[Year]) >=_min) )

 

or

 

Date diff  =
var _max = minx(allselected(Date1), Date1[year])
var _min = maxx(allselected(Date2), Date2[year])
return
calculate(countrows(Table), Filter(Table,year(Table[Date]) =_max))- calculate(countrows(Table), Filter(Table,   Year(Table[Year]) >=_min) )

 

For second code

How to use two Date/Period slicers

https://youtu.be/WSeZr_-MiTg

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.