The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
In an earlier question, I asked for a way to show the values selected in a slicer as a measure:
Solved: Return Selected Item(s) from a slicer in a measure - Microsoft Power BI Community
I wanted to show "All", "Item X" or "N Items selected" depending upon how many boxes were checked on the slicer.
The provided solution (from @AntrikshSharma) that I accepted worked in the case of a single slicer being selected:
Measure =
VAR SelectedMember =
COUNTROWS ( VALUES ( Staff_Details[Staff Member] ) )
VAR All_Members =
COUNTROWS ( ALL ( Staff_Details[Staff Member] ) )
VAR Result =
SWITCH (
TRUE(),
All_Members = SelectedMember, "All Selected",
SelectedMember = 0, "No Member Selected",
SelectedMember = 1, SELECTEDVALUE ( Staff_Details[Staff Member] ),
SelectedMember > 1, SelectedMember & " Staff members Selected"
)
RETURN Result
However, because I then applied other slicers to the data, this solution no longer works. For example if a Slicer that selects another filter is applied - e.g. Store - it results in the number of rows on the data being filtered so that SelectedMember != All_Members and therefore the Result showing N staff members selected. What I want is that "All" to remain selected as no staff member has specifically being selected in the Slicer.
Whilst the above is technically valid because it is based on the data table, what I really want is something that reflects the value of the boxes selected in the slicer, irrespective of what happens to the underlying data.
Is there way to diretly interpret the slicer selection, or is a workaround required that relies on the underlying table?
hi @BrisbanePom
try like:
User | Count |
---|---|
17 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
26 | |
13 | |
12 | |
9 | |
8 |