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
Anonymous
Not applicable

Using a single slider for four dates column

Hi All,

 

I have fours Dates columns in table

Like

AFromDate, BTodate, CFromDate,DTodate

 

The issue is i want to use single date to selecte all the period within these four dates.

 

I have created below Measure and used in visual level filters and set to 1.

It is working fine for two columns but not for all four columns.

Measure =
IF (
SELECTEDVALUE ( 'A'[SrFromDate] ) <= MAX ( DimDate[FullDateAlternateKey] )
&& SELECTEDVALUE ( 'B'[SrToDate] ) >= MIN ( DimDate[FullDateAlternateKey] )
&& SELECTEDVALUE ( 'A'[TsFromDate] ) <= MAX ( DimDate[FullDateAlternateKey] )
&& SELECTEDVALUE ( 'B'[TsToDate] ) <= MAX ( DimDate[FullDateAlternateKey] ),
1,0
)
 
Any correction required to make workable for all four columns?
Looking forward to solutions from Masters.
 
Regards,
 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

It is by design.

You are using SELECTEDVALUE ( 'TableA'[TsFromDate] ) and SELECTEDVALUE ( 'TableA'[TsToDate] ) in the formula.

Remember that SELECTEDVALUE function rely on context, you will need the columns in visual.

 

Best Regards,

Jay

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous ,

 

It is by design.

You are using SELECTEDVALUE ( 'TableA'[TsFromDate] ) and SELECTEDVALUE ( 'TableA'[TsToDate] ) in the formula.

Remember that SELECTEDVALUE function rely on context, you will need the columns in visual.

 

Best Regards,

Jay

lukiz84
Memorable Member
Memorable Member

Can you show some sample rows where it doesn't work?

Anonymous
Not applicable

Thanks Lukiz for response.

 

Now that issue has been resolved.

 

Can you help me to resolve below DAX.

 

 

TS Count =

var flag =
IF (
SELECTEDVALUE ( 'TableA'[TsFromDate] ) <= MAX ( DimDate[FullDateAlternateKey] )
&& SELECTEDVALUE ( 'TableA'[TsToDate] ) >= MIN ( DimDate[FullDateAlternateKey] )
,
1,0
)
var TsCount =
IF (
flag = 1, CALCULATE(COUNT('TableA'[TS_ID])) + 0,0

)
return TsCount
 
Right now, Current selection in slicer is september, 2022.
In my grid, when i put both columns so above Dax measure works fine and calculate count as required as shown below.
 
farhadidrees_0-1666255089746.png

 

But when i remove date columns in grid so it does not work and count is 0.

farhadidrees_1-1666255166436.png

I dont need to show dates in Grid as per requirment.

 

Any suggestion would be highly appreciated.

 

 

 

 

 

 

 

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.