Forum Discussion
Custom slier values that filter/slice data source table using custom contidions
- Anonymous1 year ago
Hi, gsrikar33
Regarding the issue you raised, my solution is as follows:
1.First I have created the following table and the column names and data are the data you have given:
2.You need to create the following calculated table and use it as a slicer, ensuring that the slicer does not directly affect the original data.
ShiftSelection = DATATABLE("Shift", STRING, {{"Shift 1"}, {"Shift 2"}})3. Below are the measure I've created for your needs:
Shift1Filter = VAR SELECT1 = SELECTEDVALUE ( 'ShiftSelection'[Shift] ) VAR SHIFT1 = IF ( MAX ( 'Table'[Due Date] ) >= TODAY () && MAX ( 'Table'[ETD Date] ) < TODAY () + 1, 1, 0 ) VAR SHIFT2 = IF ( MAX ( 'Table'[Due Date] ) = TODAY () && MAX ( 'Table'[Due Time (Z)] ) >= TIME ( 22, 0, 0 ) && ( MAX ( 'Table'[ETD Date] ) = TODAY () || MAX ( 'Table'[ETD Date] ) = TODAY () + 1 && MAX ( 'Table'[ETD Time (Z)] ) <= TIME ( 10, 0, 0 ) ), 1, 0 ) RETURN IF ( ISFILTERED ( 'ShiftSelection'[Shift] ), IF ( SELECT1 = "Shift 1", SHIFT1, SHIFT2 ), 1 )4.Apply measure to visual object filters.
5.Here's my final result, which I hope meets your requirements.
Please find the attached pbix relevant to the case.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, gsrikar33
Regarding the issue you raised, my solution is as follows:
1.First I have created the following table and the column names and data are the data you have given:
2.You need to create the following calculated table and use it as a slicer, ensuring that the slicer does not directly affect the original data.
ShiftSelection = DATATABLE("Shift", STRING, {{"Shift 1"}, {"Shift 2"}})
3. Below are the measure I've created for your needs:
Shift1Filter =
VAR SELECT1 =
SELECTEDVALUE ( 'ShiftSelection'[Shift] )
VAR SHIFT1 =
IF (
MAX ( 'Table'[Due Date] ) >= TODAY ()
&& MAX ( 'Table'[ETD Date] )
< TODAY () + 1,
1,
0
)
VAR SHIFT2 =
IF (
MAX ( 'Table'[Due Date] ) = TODAY ()
&& MAX ( 'Table'[Due Time (Z)] ) >= TIME ( 22, 0, 0 )
&& (
MAX ( 'Table'[ETD Date] ) = TODAY ()
|| MAX ( 'Table'[ETD Date] )
= TODAY () + 1
&& MAX ( 'Table'[ETD Time (Z)] ) <= TIME ( 10, 0, 0 )
),
1,
0
)
RETURN
IF (
ISFILTERED ( 'ShiftSelection'[Shift] ),
IF ( SELECT1 = "Shift 1", SHIFT1, SHIFT2 ),
1
)
4.Apply measure to visual object filters.
5.Here's my final result, which I hope meets your requirements.
Please find the attached pbix relevant to the case.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- gsrikar331 year agoAdvocate II
You made my day!
Thanks a ton for the solution.