Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Parse a slicer through a DAX command

Hey folks,

I am trying to parse a slicer though a DAX command and what I have tried so far hasn't work thus I would appreciate any help on this.

 

I have a "CALCULATE" command in a formula that looks like this

'

Baseline = CALCULATE(COUNTA('NewTable'[ID]),
filter(NewTable,NewTable[Base].[Date]=newesttable[End Time].[Date]
&&
CONTAINSSTRING(NewTable[Group], "*Attribute1*") = TRUE())
)
The current way I build this report is I create a new table for every "Atrribute1" and replace with appropriate attribute. Attribute1 is a string variable.
A new request was made for a slicer, especially as said report should contain 80 different attributes!!
 
The approach adopted so far has been to create a measure. The measure calculation is measure2 =SelectedValue(Attributes).
 
I have tried the following, but got no result.
1.
Baseline = CALCULATE(COUNTA('NewTable'[ID]),
filter(NewTable,NewTable[Base].[Date]=newesttable[End Time].[Date]
&&
CONTAINSSTRING(NewTable[Group], measure2) = TRUE())
)
 
2. I also tried this:
var val=SELECTEDVALUE(NewTable[CREWGROUP])
return
CALCULATE(COUNTA('NewTable'[ID]),
filter(NewTable,NewTable[Base].[Date]=newesttable[End Time].[Date]
&& 
NewTable[GROUP] = val).
 
Option 1 pretty much attempts to make the dax formular reference the measure, while option 2 tries to make the dax formular reference the selection on the page. But have been unsuccessful.
 
Any recommendation of a better way of doing this? A way to make a DAX command harvest the selection on a slicer?
 
Thanks.
 
1 REPLY 1
lbendlin
Super User
Super User

You may be overcomplicating things.  Use the FILTERS() function, and then INTERSECT() etc as needed.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.