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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Thomasshepherd2
Frequent Visitor

using selected value to return a list of customers between dates

Hi All

 

I am trying to show a rolling 12months of customers in a Matrix visual where the enddate is set by slicer and the startdate is always 12months before 

 

this is what i have 

NewBizCustomers =

VAR SelectedDate = LASTDATE(ALLSELECTED('Calendar'[Date]))

VAR SelectedYear = YEAR(SelectedDate)

VAR SelectedYearminus1 = YEAR(SelectedDate)-1

VAR SelectedMonth = MONTH(SelectedDate)

VAR SelectedDay = DAY(SelectedDate)

VAR CurrentYear = YEAR(TODAY())

 

VAR StartDate =

  DATE(SelectedYearminus1,SelectedMonth,SelectedDay)

VAR EndDate =

        DATE(SelectedYear , SelectedMonth, SelectedDay)

Var Result =

FILTER(

    VALUES('List of ACTs'[CustomerName]),DATESBETWEEN('List of ACTs'[Customer Startdate], StartDate,EndDate)

)

RETURN

Result

 

however, this doesn’t filter the customer name.

 

I have looked through Forums but not having much luck - any help is very much appreciated.

 

EDIT:
here is screenshot of the data

i want it so that the startdate is always 12months behind the slicer 

eg the able nz would not be on this list unless the date was 7/1/22

 

Thomasshepherd2_0-1731031542874.png

 

1 ACCEPTED SOLUTION
Thomasshepherd2
Frequent Visitor

Found a way to do it by creating the following measure 

CustomerInRolling12Months =
VAR SelectedDate = LASTDATE(ALLSELECTED('Calendar'[Date]))
VAR StartDate = EDATE(SelectedDate, -12) + 1
VAR EndDate = SelectedDate

RETURN
IF(
MIN('List of ACTs'[Customer Startdate]) >= StartDate &&
MIN('List of ACTs'[Customer Startdate]) <= EndDate,
1,
0
)

 

 

Then adding this to the visual filters and settings it to only show 1 as the result 

 

Cheers all

View solution in original post

4 REPLIES 4
Thomasshepherd2
Frequent Visitor

Found a way to do it by creating the following measure 

CustomerInRolling12Months =
VAR SelectedDate = LASTDATE(ALLSELECTED('Calendar'[Date]))
VAR StartDate = EDATE(SelectedDate, -12) + 1
VAR EndDate = SelectedDate

RETURN
IF(
MIN('List of ACTs'[Customer Startdate]) >= StartDate &&
MIN('List of ACTs'[Customer Startdate]) <= EndDate,
1,
0
)

 

 

Then adding this to the visual filters and settings it to only show 1 as the result 

 

Cheers all

FreemanZ
Community Champion
Community Champion

hi @Thomasshepherd2 ,

 

it seems you are writing a calculated table, which is not supposed to respond to visual behaviors (like slicer).

Ritaf1983
Super User
Super User

Hi @Thomasshepherd2 

Please provide a workable sample data and your expected result from that. It is hard to figure out what you want to achieve from the description alone.  

https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

 

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Made an edit to the post showing how i am wanting to show the data.

 

Let me know if it is still unclear.

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.

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.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.