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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
sriramn84
Frequent Visitor

DateSelected +/- 1 day filter

All,

I have a datetable and filters setup and is all good.(Please find attached the pbix file). Now I have a date relationship between DriverLog and AutoPosition already.

 

Capture.JPG

What I am trying : When a row is selected in the DriverLog(screenshot below), We need to Display any records on the AutoPosition table, irrespective of the Loc, show all the BusIds  in the CreatedDate +/- 1 day range(As shown in the AutoPosition in the image). Important : I need the existing relationships.

 Untitled.jpg

 

I have tried DAX queries to create a table with the filtered valies, but couldnt get through.

(Not finding the Attach Option) Pbix File : https://gofile.io/?c=glt7Hi

Thanks in advance

 

 

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

Hello @sriramn84 

You can use a measure as a filter on the AutoPosition table to get what you are looking for.

SelectedDriverLog = 
VAR StartDate = MIN (  DriverLog[Date]  ) -1
VAR EndDate = MAX ( DriverLog[Date] ) +1
VAR Result = 
CALCULATE(
    COUNTROWS( AutoPosition ),
    FILTER (
        AutoPosition,
        AutoPosition[CreatedDate] >= StartDate &&
        AutoPosition[CreatedDate] <= EndDate
    )
)

RETURN Result

Then you apply this measure as a filter to the visual displaying the AutoPosition data and set it to 'Is Not Blank'
DriverFilter.jpg

 

 

If a user selects more than 1 row in your DiverLog visual it will use the date range to pick which rows to display in the AutoPosition visual.

DriverFilterSelection.jpg

View solution in original post

2 REPLIES 2
jdbuchanan71
Super User
Super User

Hello @sriramn84 

You can use a measure as a filter on the AutoPosition table to get what you are looking for.

SelectedDriverLog = 
VAR StartDate = MIN (  DriverLog[Date]  ) -1
VAR EndDate = MAX ( DriverLog[Date] ) +1
VAR Result = 
CALCULATE(
    COUNTROWS( AutoPosition ),
    FILTER (
        AutoPosition,
        AutoPosition[CreatedDate] >= StartDate &&
        AutoPosition[CreatedDate] <= EndDate
    )
)

RETURN Result

Then you apply this measure as a filter to the visual displaying the AutoPosition data and set it to 'Is Not Blank'
DriverFilter.jpg

 

 

If a user selects more than 1 row in your DiverLog visual it will use the date range to pick which rows to display in the AutoPosition visual.

DriverFilterSelection.jpg

Iamnvt
Continued Contributor
Continued Contributor

hi,

 

you can write this measure:

Measure = 
VAR
selecteddate = SELECTEDVALUE(DimDate[Date])
RETURN
COUNTROWS(FILTER(CROSSJOIN(ALL(DimDate[Date]), ALL(Location[Location])), DimDate[Date] >= selecteddate -1 && DimDate[Date] <= selecteddate +1 && FIRSTNONBLANK(AutoPosition[CreatedDate],0) <> BLANK()))

then put it in Autoposition table, or put it in the Filter Panel.

Here is the PBI file:

https://1drv.ms/u/s!Aps8poidQa5zk6pwiK9ARswHmJsjaQ

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors
Top Kudoed Authors