Oct 10 2022 08:36 PM
I need to capture the selected value of a slicer like ID or Date. In browsing the Slicer Settings, there a defined name for the Slicer and stated that its can be used in a formula. I tried to in insert in a cell =INDERECT formula or simply =defined name but none did work.
Is there a way to get the value of selected slicer?
Oct 10 2022 10:29 PM - edited Oct 10 2022 10:34 PM
@Thamer_Tarabzouni The attached article clearly demonstrates how to do just that. And at the end it also explains the real meaning of the bit "Name to use in formulas:"
https://www.myonlinetraininghub.com/use-excel-slicer-selection-in-formulas
Oct 10 2022 11:26 PM
Alternatively if you run Excel > 2010 on Windows, load your SourceTable to the Data Model (Power Pivot):
in I11 (returns the 1st item selected in Slicer_Name:(
=CUBERANKEDMEMBER("ThisWorkbookDataModel",
CUBESET("ThisWorkbookDataModel", Slicer_Name),
1
)
Corresponding sample attached
Feb 20 2023 02:22 AM
And if on 365 to return multiple selections
slicerSelection=
LAMBDA( connection, slicer,
LET(
itemsSelected, CUBESETCOUNT( CUBESET(connection, slicer) ),
CUBERANKEDMEMBER(connection,slicer, SEQUENCE( itemsSelected )))
);
called as
=slicerSelection("ThisWorkbookDataModel", Slicer_Name)
Feb 20 2023 02:42 AM
hi @L z. , I just want to ask if you know how to solve the duplicated value that is not displaying in pivot table just like in the photos. Even if I click in the slicer, duplicated value will just show 1 result. please help. Thank you.
Feb 21 2023 07:29 AM
You're asking for a PivotTable to not behave as a PivotTable (what's the point???)
If you run Excel > 2013 / Windows you can do it though:
- Load the Pivot Source table to Power Query
- Add an ID (Index) column
- Build the PivotTable from the query
- Add the ID column to the Rows area of the PivotTable
- Hide the column that holds the [ID] field
Sample attached
Feb 21 2023 03:27 PM