Forum Discussion
Filter Date Slicer To Only Show Months With Full Data
Hi All,
I have a dataset where three of my tables are excel tables that I have to update manually. I want to filter the date slicer visual (Month&Year) on the report page to only allow selections of months when the data is complete for that month.
In other words if the max date of any of the 3 tables is in September 2021 only allow to select up to August 2021 because the data for September isn't complete.
Here is an example of my three tables:
Temp Hours
| Date | Hours |
| 09/05/2021 | 36.00 |
| 10/07/2018 | 35.00 |
| 10/14/2018 | 26.00 |
Punch_Report
| DATE | TOTAL |
| 9/25/2021 | 1.5 |
| 9/24/2021 | 5.32 |
| 9/23/2021 | 5.82 |
Warehouse Errors: (Max of any of the date fields, if this is too hard my relationship is to 'Date of Occurence' so can just use that one)
| Date of Occurence | Item | Date Created | Date Closed | Last Modified |
| 6/19/2019 14:17 | 1-ABC | 6/30/2021 11:14 | 6/30/2021 12:14 | 9/30/2021 12:14 |
| 7/19/2019 0:00 | 2-CDE | 7/31/2019 14:40 | 8/1/2019 18:05 | 8/17/2020 13:34 |
| 10/15/2019 0:00 | 3-EFG | 12/18/2019 12:54 | 12/19/2019 18:17 | 12/19/2019 18:17 |
Date Table (Just 2 of my many columns in the date table. I use this one)
| Date | Month & Year |
| 8/3/2021 | Aug 2021 |
| 9/7/2021 | Sep 2021 |
| 10/5/2021 | Oct 2021 |
My dataset is already slow so I would appreciate any quick performing DAX rather than calculated columns.
Thanks in advance!
3 Replies
- lbendlin
Super User
"when the data is complete for that month"
How do you decide that? Based on the presence of data for the next month?
- b2wise
Helper III
b2wise I tried this formula, and set a visual level filter as greater than 0 but it's not working
Date Slicer Limiter =
--Limit date slicer to previous month from latest month date
VAR maxpunchdate =
MAX ( Punch_Report[DATE] )
VAR maxtemphours =
MAX ( 'Temp Hours'[Invoice Date] )
VAR minmonth =
MONTH ( MIN ( maxpunchdate, maxtemphours ) )
VAR minyear =
YEAR ( MIN ( maxpunchdate, maxtemphours ) )
RETURN
CALCULATE (
COUNTROWS ( Dates ),
YEAR ( Dates[Date] )
&& MONTH ( Dates[Date] ) < YEAR ( minyear )
&& MONTH ( minmonth )
)