Forum Discussion

vinayganit's avatar
vinayganit
Frequent Visitor
2 years ago

Dynamic date slicer or dynamic field switch

So I have a Forecast type table to select between 2 type of forecasts from 2 different files. I have linked them to a common date table. I created a measure to calculate min and max dates of the order date of both these files based on selection. If it is a one time forecast then min of order date of that frecast file and if it is rolling min of that similarly for Max. But I added a column in date table to make a slicer with range changing based on my forecast type selection but it is returning blank or it is out of range. Is it because my selection is in front end? Now if that is not possible i can remove the date slicer and I have  aline chart so i have selected forecast as a measure which is as follows

Selected Forecast =
VAR SelectedType = SELECTEDVALUE('Forecast Type'[FC Type])
RETURN
SWITCH(
    SelectedType,
    "Rolling Forecast", CALCULATE(SUM('Rolling Forecast '[Forecast Volumne])),
    "One-Time Forecast", CALCULATE(SUM(ForecastResults_OneTime[Forecast Volume])),
    BLANK()
)
I want to switch between order date of both these columns as well in the same format. But since date cant be aggregated how will it be possible? 
DateInRange =
VAR MinDate = [MinOrderDate]
VAR MaxDate = [MaxOrderDate]
RETURN
IF(
DateTable[Date]>=MinDate && DateTable[Date]<=MaxDate,
DateTable[Date],
BLANK()
)
This was my calculation for calculated date column for which Min order date and max orderdate as seperate measures where working fine but dates where not getting filtered. It would be great if either of the solutions can be achieved
 

1 Reply