Forum Discussion

jrhessey's avatar
jrhessey
Frequent Visitor
6 years ago
Solved

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_Slicer = CALCULATE ( MIN ( DSO_All[CustGroup] ), ALLSELECTED( DSO_All ) )
Return Select_Slicer
 
 
The value that should be returned in the "First GetChicletValue" is OE, not AFT.
 
What I'm trying to do is pass that value on to another formula to get the previous row for a specific customer group (replace the "oe" with the slicer/chiclet value).
 
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")
 
Am I on the right track or out in left field?
 
Thanks for any help, it's greatly appreciated!!

3 Replies

    • jrhessey's avatar
      jrhessey
      Frequent Visitor

      parry2k 

       

      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!!