Forum Discussion
dynamic data range
- 6 years ago
Hi Anonymous ,
Try this:
Dummy measure for filter = VAR DimensionDatePeriod = MIN ( 'DimensionDate'[Period] ) VAR SlicerSelection = MIN ( 'DimensionDateSlicer'[Period] ) VAR DimensionDatePeriodPlus3 = MIN ( 'DimensionDateSlicer'[PeriodPlus3] ) ------------Changed. RETURN IF ( ISBLANK ( SELECTEDVALUE ( DimensionDateSlicer[Period] ) ), ----------Added. 1, IF ( ( DimensionDatePeriod >= SlicerSelection ) && ( DimensionDatePeriod <= DimensionDatePeriodPlus3 ), 1 ) )Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
The data model that I posted is a simplified version of my actual data model. In my actual data model, I can't simply add 3 to Period to obtain PeriodPlus3. In my actual data model, my Period values are like 20062007.01 (to represent the first period of fiscal year 2006-2007) and 20192020.12 (to represent the last period of fiscal year 2019-2020). That is why my Dimension Date table includes columns for PeriodPlus3 / PeriodPlus3Label. In other words, I've already done the work (in the creation of the Dimension Date table ) to create the PeriodPlus3 value for every Period value. (It doesn't need to -- and shouldn't -- be done in DAX.) Is there a way to set _maxPrd from the PeriodPlus3 value already in the table? (I think this is one of the things that makes my data model unique, as every solution I've seen for this problem always computes the _maxPrd variable through math, rather than fetching it from a table.)
Hi Anonymous ,
Try this:
Dummy measure for filter =
VAR DimensionDatePeriod =
MIN ( 'DimensionDate'[Period] )
VAR SlicerSelection =
MIN ( 'DimensionDateSlicer'[Period] )
VAR DimensionDatePeriodPlus3 =
MIN ( 'DimensionDateSlicer'[PeriodPlus3] ) ------------Changed.
RETURN
IF (
ISBLANK ( SELECTEDVALUE ( DimensionDateSlicer[Period] ) ), ----------Added.
1,
IF (
( DimensionDatePeriod >= SlicerSelection )
&& ( DimensionDatePeriod <= DimensionDatePeriodPlus3 ),
1
)
)
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.