Forum Discussion
jrhessey
6 years agoFrequent Visitor
Dax Filter Using slicer/Chiclet Value?
I'm trying to a plly a chiclet/slicer value to a dax filter fomula. I found a post on here that I thought would work, but it's not returning the correct value GetChicletValue = Var Select_Slice...
- 6 years ago
Make sure it is a measure, not calculated column. Besides, take a good look at https://www.sqlbi.com/articles/filter-arguments-in-calculate/.
parry2k
6 years agoSuper User
jrhessey
6 years agoFrequent Visitor
How do I pass that value in to the following formula?
PreviousTotalOpen =
var PreviousDate = MAXX(FILTER(ALL(DSO_All),EARLIER(DSO_All[RunDate]) > DSO_All[RunDate] ),DSO_All[RunDate])
//return PreviousDate
Return CALCULATE(SUM(DSO_All[Calculated_OPENSALEDOLLAR]),FILTER(DSO_All,DSO_All[RunDate] = PreviousDate), DSO_All[CustGroup]="oe")
I want to replace the "oe" with the selected value. I tried
DSO_All[CustGroup]=GetChicletValue
but I get the error that "a calculate function has been used in a true/false expression that is used as a table filter expression. this is not allowed."
So I tried setting a variable
Var Select_Slicer = SELECTEDVALUE( DSO_All[CustGroup] )
and using this code
DSO_All[CustGroup]=Select_Slicer
I don't recieve any errors, but the column goes blank.
Here is the end goal, whatever values I select i nthe CustGroup and ForecastCode chiclet/slicers should be inserted into the appropriate section of the formula where "custgroup" or "forecastcode".
So I could have selected OE and AFT for custgroup and A and B for forecastcode for example. All those rows should be returned for the top table to sum, etc.
Hopefully this makes it a little more clear. Thanks for your help parry2k!!
- v-chuncz-msft6 years agoCommunity Support
Make sure it is a measure, not calculated column. Besides, take a good look at https://www.sqlbi.com/articles/filter-arguments-in-calculate/.