Forum Discussion

jessecrosswhite's avatar
jessecrosswhite
New Member
6 years ago
Solved

need help getting selected slicer values

I have a simple query with one column that I want to use to in DAX. I have the column in a slicer to select a value but no mater what I select I always get all the rows in my DAX caculation. to test I'm using the below DAX as a calculated to feed a card

 

Column = CONCATENATEX(values(warehouseQuery[in_whs_key]),warehouseQuery[in_whs_key],", ")
 
I've also tried Allselected but I think i'm missing something fundemental about sliced sleected values
because in the end I want something like the below to tell me if the warehouse and date is selected but it
always temms me they are all selected
 
row selected =
  var selectedDates = ALLSELECTED(datesQuery[Scheduled_Ship_date])
  var selectedWarehouses = ALLSELECTED(warehouseQuery[in_whs_key])
  return
  CALCULATE(
COUNTX(
    filter(listOfOrdersQuery, listOfOrdersQuery[in_whs_key] in selectedWarehouses
            && listOfOrdersQuery[Scheduled_Ship_date] in selectedDates )
    ,listOfOrdersQuery[order transfer]) 
)

 

 

  • Basicly DAX can't work with test fields like that. It can with numbers but not with text. For instance if you build a table like 

     

    Column1Column2
    A1
    B10
    C100

     

    then a formula like 

    Column3 = CALCULATE( sum('Table'[Column2]),ALLSELECTED('Table'[Column1],'Table'[Column1]))
    will indicate which values have been selected but
    Column4 = Calculate(CONCATENATEX(ALLSELECTED('Table'[Column1]),'Table'[Column1],", "))
    will always return A, B, C
     
    It seemed like a way to get around the many-to-many restrictions with out having to build a new view

3 Replies

  • below is some sample data. the slicers would be on the 1st 2 tables and I want them to filter the 3rd. from the 3rd table I would take the 'order transfer' data and filter the data on the final result table

     

    Scheduled_Ship_date
    20.03.13
    20.03.14
    20.03.15

     

    in_whs_key
    014
    050
    122
    128
    144
    146
    148

     

    order transferin_whs_keyScheduled_Ship_date
    14506011420.03.14
    14506015020.03.13
    145062114420.03.13
    145590112820.03.13
    145590114620.03.15
    145659112220.03.13
    145659114820.03.13
    145659312820.03.13
    145659514620.03.15
  • Basicly DAX can't work with test fields like that. It can with numbers but not with text. For instance if you build a table like 

     

    Column1Column2
    A1
    B10
    C100

     

    then a formula like 

    Column3 = CALCULATE( sum('Table'[Column2]),ALLSELECTED('Table'[Column1],'Table'[Column1]))
    will indicate which values have been selected but
    Column4 = Calculate(CONCATENATEX(ALLSELECTED('Table'[Column1]),'Table'[Column1],", "))
    will always return A, B, C
     
    It seemed like a way to get around the many-to-many restrictions with out having to build a new view