Forum Discussion
Dynamic Date Filter Toggles
- 6 months ago
i ended up creating the date/calendar table
then creating this calculated column Is_L5W_Exc & Is_L5W_Inc as below
Is_L5W_Exc =VAR TodayDate = TODAY()VAR StartOfCurrentWeek = TodayDate - WEEKDAY(TodayDate, 2) + 1VAR StartOfPeriod6 = StartOfCurrentWeek - 35RETURNIF(Calendar[Date] >= StartOfPeriod6 &&Calendar[Date] < StartOfCurrentWeek,TRUE(),FALSE())
then in my measures i did*Customer Count Last 5 Weeks =VAR Mode = SELECTEDVALUE('Selector - Timeframe'[Options])RETURNSWITCH(Mode,"Inc", CALCULATE(DISTINCTCOUNT('FACT_CALLS'[UniqueIdentifier]), Calendar[Is_L5W_Inc] = TRUE()),"Exc", CALCULATE(DISTINCTCOUNT('FACT_CALLS'[UniqueIdentifier]), Calendar[Is_L5W_Exc] = TRUE()),BLANK())
- Create a disconnected table with values like "Include" and "Exclude".
- Use a slicer on that table to let users choose.
- Write a DAX measure that checks the slicer selection and applies different date logic.
- Filter visuals using that measure (e.g., [IsInDateRange] = TRUE).
It wouldn't let me create a measure from a column
- MasonMA9 months agoSuper User
Hi,
After you created a disconnected table with below logic,
Create a Measure, for example with below logic to show Past 3 days 'Request count' when user selects 'Include'.
IsInDateRange = VAR Selection = SELECTEDVALUE('ParameterTable'[Parameter], "Include") RETURN CALCULATE( COUNTROWS('Request'), FILTER( 'Request', IF( Selection = "Include", 'Request'[Created Date] >= TODAY()-3, 'Request'[Created Date] < TODAY()-3 ) ) )- Saffy9 months agoNew Member
Do I have to do that for each calculation , like for each metric? Each measure or can that be applied to the filter
I have a few, net sales, margin, count orders, count of products etc..av