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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.