cancel
Showing results for 
Search instead for 
Did you mean: 

Selected value

Frequent Visitor
1614 Views
Highlighted
verneroberts Frequent Visitor
Frequent Visitor

Selected value

Most reports I make have a dynamic header using the Enlighten Data Story where I have the title update to show which filter values the user has currently selected as they interact with the report.

 

 

 

Selected State = 
VAR __allLabel = "The U.S."
VAR __maxCount = 5
VAR __maxLabel = "multiple states"
VAR __totalCount = CALCULATE(DISTINCTCOUNT('Table'[State]),ALL('Table'))
VAR __selectedCount = DISTINCTCOUNT('Table'[State])
RETURN
	IF(		
		__selectedCount = 1,
		VALUES('Table'[State]), 
		IF (
			__selectedCount = __totalCount, 
			__allLabel,
			IF (
				__selectedCount > __maxCount,
				__maxLabel,
				CONCATENATEX(TOPN(__selectedCount-1,VALUES('Table'[State])),'Table'[State],", ") & " and " & LASTNONBLANK(VALUES('Table'[State]),true)
			)
		)
	)