Forum Discussion
jcamilo1985
5 months agoHelper III
cancel slicer dates
First of all, thank you so much to everyone who takes the time to read this post. I have the following scenario: two calendar tables. The first (calendar1) is connected to the fact table via the `fe...
- 5 months ago
Step 1) Helper: Selected date (or today) and the 7-day window
_Selected Date = COALESCE ( SELECTEDVALUE ( calendar1[Fecha] ), TODAY() ) _In Window = VAR Cutoff = [_Selected Date] VAR StartD = Cutoff - 7 VAR EndD = Cutoff - 1 VAR ThisD = MAX ( calendar1[Fecha] ) RETURN IF ( ThisD >= StartD && ThisD <= EndD, 1, 0 )Put "_In Window" in the visual-level filters and keep only = 1. This makes the table show only the 7 days prior.
Step 2) Count by fecha_radicacion (calendar1)
Orders (Radicacion) = VAR Cutoff = [_Selected Date] VAR StartD = Cutoff - 7 VAR EndD = Cutoff - 1 RETURN CALCULATE ( COUNTROWS ( Fact ), REMOVEFILTERS ( calendar1[Fecha] ), DATESBETWEEN ( calendar1[Fecha], StartD, EndD ) )Step 3) Count by fecha_solucion (calendar2) without being restricted by filing date
Orders (Solucion) = VAR DatesOnAxis = VALUES ( calendar1[Fecha] ) RETURN CALCULATE ( COUNTROWS ( Fact ), REMOVEFILTERS ( calendar1 ), TREATAS ( DatesOnAxis, calendar2[Fecha] ) )
danextian
5 months agoSuper User
Hi jcamilo1985
As what hnguy71 has suggested, one of the calendar tables has to be disconnected. Filters from a related or the same table will show only the rows selected. Functions that modify the filter context can only override the value being returned by a measure but not the visible rows.
jcamilo1985
5 months agoHelper III
Thanks for replying.