Forum Discussion
Custom Slicer on INT value
Please help me create a custom table slicer with the criteria below
Custom Slicer Table =
Number of Days <= 15
Number of Days >= 15 & Number of Days =< 30
Number of Days = All Number of Days
Actual Table
| Group_ID | Number of Days |
| T-1000 | 28 |
| T-1001 | 23 |
| T-1002 | 22 |
| T-1003 | 20 |
| T-1004 | 19 |
| T-1005 | 14 |
| T-1006 | 19 |
| T-1007 | 36 |
| T-1008 | 21 |
| T-1009 | 14 |
| T-1010 | 14 |
Hi Anonymous , You can create a calculated column with below dax and pull it inside a slicer. Enable select all option for the slicer to select all the days
Range = SWITCH(TRUE(), 'Table'[Number of Days] <= 15, "<= 15 Days", 'Table'[Number of Days] > 15 && 'Table'[Number of Days] <= 30,"> 15 and <= 30 Days",">30 Days")Did I answer your question ? If yes, please mark my post as a solution
Thanks,
Jai
4 Replies
- Jai-RathinavelSuper User
Hi Anonymous , You can create a calculated column with below dax and pull it inside a slicer. Enable select all option for the slicer to select all the days
Range = SWITCH(TRUE(), 'Table'[Number of Days] <= 15, "<= 15 Days", 'Table'[Number of Days] > 15 && 'Table'[Number of Days] <= 30,"> 15 and <= 30 Days",">30 Days")Did I answer your question ? If yes, please mark my post as a solution
Thanks,
Jai
- AnonymousNot applicable
How to set the order of the Range?
1. All
2. <= 15 Days
3. > 15 and <= 30 Days",">30 Days
- Kedar_PandeSuper User
Anonymous
Create a New Calculated Table for the Slicer
Custom Slicer Table =
DATATABLE(
"Range", STRING,
{
{"Number of Days <= 15"},
{"Number of Days >= 15 & Number of Days <= 30"},
{"All Number of Days"}
}
)Create a Measure for Filtering
Filtered Measure =
VAR SelectedRange = SELECTEDVALUE('Custom Slicer Table'[Range])
RETURN
SWITCH(
TRUE(),
SelectedRange = "Number of Days <= 15", IF(MAX('Actual Table'[Number of Days]) <= 15, 1, 0),
SelectedRange = "Number of Days >= 15 & Number of Days <= 30", IF(MAX('Actual Table'[Number of Days]) >= 15 && MAX('Actual Table'[Number of Days]) <= 30, 1, 0),
SelectedRange = "All Number of Days", 1,
0
)Add the Custom Slicer Table to your report and use it as a slicer.
Add the Actual Table to your visuals (e.g., table or chart).
Go to the Filters pane for the visual and apply the Filtered Measure as a filter, setting the value to 1.💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn- AnonymousNot applicableI am trying your version, and getting error "The MAX function in DAX only accepts a column reference as an argument"How to fix?
Filtered Measure =VAR SelectedRange = SELECTEDVALUE('Custom Slicer Table'[Range])RETURNSWITCH(TRUE(),SelectedRange = "Number of Days <= 15", IF(MAX('Invoices'[Number of Days before invoice received by AP]) <= 15, 1, 0),SelectedRange = "Number of Days >= 15 & Number of Days <= 30", IF(MAX('Invoices'[Number of Days before invoice received by AP]) >= 15 &&MAX('Invoices'[Number of Days before invoice received by AP]) <= 30, 1, 0),SelectedRange = "All Number of Days", 1,0)