Forum Discussion
Identify missing dates in table
- Anonymous2 years ago
Ritaf1983 Thanks for your contribution on this thread.
Hi Eyal ,
I created a sample pbix file(see the attachment), please check if that is what you want. You can follow the steps to get it:
1. Create a date dimension table
Date = VALUES('Table'[Date])2. Create a measure as below
Flag = VAR _date = SELECTEDVALUE ( 'Date'[Date] ) VAR _lot = SELECTEDVALUE ( 'Table'[Lot #] ) VAR _attr = SELECTEDVALUE ( 'Table'[Attribute] ) VAR _tdate = CALCULATE ( MAX ( 'Table'[Date] ), FILTER ( 'Table', 'Table'[Lot #] = _lot && 'Table'[Attribute] = _attr && 'Table'[Date] = _date ) ) RETURN IF ( _tdate = _date, 0, 1 )3. Create a table visual and apply a visual-level filter with the condition(Flag is 1)
Best Regards
thanks for reaching out,
the source table :
| Lot # | Date | Attribute | Value |
| Lot A | 01/01/2024 | Attribute 1 | 1 |
| Lot A | 02/01/2024 | Attribute 1 | 3 |
| Lot A | 03/01/2024 | Attribute 1 | 45 |
| Lot A | 04/01/2024 | Attribute 1 | 5 |
| Lot A | 05/01/2024 | Attribute 1 | 7 |
| Lot A | 06/01/2024 | Attribute 1 | 2 |
| Lot A | 07/01/2024 | Attribute 1 | 8 |
| Lot A | 08/01/2024 | Attribute 1 | 9 |
| Lot A | 09/01/2024 | Attribute 1 | 3 |
| Lot A | 10/01/2024 | Attribute 1 | 2 |
| Lot A | 01/01/2024 | Attribute 2 | 7 |
| Lot A | 02/01/2024 | Attribute 2 | 5 |
| Lot A | 03/01/2024 | Attribute 2 | 3 |
| Lot A | 04/01/2024 | Attribute 2 | 7 |
| Lot A | 06/01/2024 | Attribute 2 | 6 |
| Lot A | 07/01/2024 | Attribute 2 | 3 |
| Lot A | 08/01/2024 | Attribute 2 | 2 |
| Lot A | 10/01/2024 | Attribute 2 | 2 |
| Lot B | 01/01/2024 | Attribute 1 | 1 |
| Lot B | 02/01/2024 | Attribute 1 | 3 |
| Lot B | 03/01/2024 | Attribute 1 | 45 |
| Lot B | 04/01/2024 | Attribute 1 | 5 |
| Lot B | 05/01/2024 | Attribute 1 | 7 |
| Lot B | 06/01/2024 | Attribute 1 | 2 |
| Lot B | 07/01/2024 | Attribute 1 | 8 |
| Lot B | 08/01/2024 | Attribute 1 | 9 |
| Lot B | 09/01/2024 | Attribute 1 | 3 |
| Lot B | 10/01/2024 | Attribute 1 | 2 |
| Lot B | 01/01/2024 | Attribute 2 | 7 |
| Lot B | 03/01/2024 | Attribute 2 | 3 |
| Lot B | 04/01/2024 | Attribute 2 | 7 |
| Lot B | 05/01/2024 | Attribute 2 | 8 |
| Lot B | 06/01/2024 | Attribute 2 | 6 |
| Lot B | 07/01/2024 | Attribute 2 | 3 |
| Lot B | 08/01/2024 | Attribute 2 | 2 |
| Lot B | 09/01/2024 | Attribute 2 | 6 |
| Lot B | 10/01/2024 | Attribute 2 | 2 |
the resulting table should be the following :
| Lot # | Date | Attribute |
| Lot A | 05/01/2024 | Attribute 2 |
| Lot A | 09/01/2024 | Attribute 1 |
| Lot B | 02/01/2024 | Attribute 2 |
thanks for your help
Ritaf1983 Thanks for your contribution on this thread.
Hi Eyal ,
I created a sample pbix file(see the attachment), please check if that is what you want. You can follow the steps to get it:
1. Create a date dimension table
Date = VALUES('Table'[Date])
2. Create a measure as below
Flag =
VAR _date =
SELECTEDVALUE ( 'Date'[Date] )
VAR _lot =
SELECTEDVALUE ( 'Table'[Lot #] )
VAR _attr =
SELECTEDVALUE ( 'Table'[Attribute] )
VAR _tdate =
CALCULATE (
MAX ( 'Table'[Date] ),
FILTER (
'Table',
'Table'[Lot #] = _lot
&& 'Table'[Attribute] = _attr
&& 'Table'[Date] = _date
)
)
RETURN
IF ( _tdate = _date, 0, 1 )
3. Create a table visual and apply a visual-level filter with the condition(Flag is 1)
Best Regards