Forum Discussion
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
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
Column1 Column2 A 1 B 10 C 100 then a formula like
Column3 = CALCULATE( sum('Table'[Column2]),ALLSELECTED('Table'[Column1],'Table'[Column1]))will indicate which values have been selected butColumn4 = Calculate(CONCATENATEX(ALLSELECTED('Table'[Column1]),'Table'[Column1],", "))will always return A, B, CIt seemed like a way to get around the many-to-many restrictions with out having to build a new view
3 Replies
- Greg_DecklerCommunity Champion
Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
- jessecrosswhiteNew Member
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 transfer in_whs_key Scheduled_Ship_date 1450601 14 20.03.14 1450601 50 20.03.13 1450621 144 20.03.13 1455901 128 20.03.13 1455901 146 20.03.15 1456591 122 20.03.13 1456591 148 20.03.13 1456593 128 20.03.13 1456595 146 20.03.15 - jessecrosswhiteNew Member
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
Column1 Column2 A 1 B 10 C 100 then a formula like
Column3 = CALCULATE( sum('Table'[Column2]),ALLSELECTED('Table'[Column1],'Table'[Column1]))will indicate which values have been selected butColumn4 = Calculate(CONCATENATEX(ALLSELECTED('Table'[Column1]),'Table'[Column1],", "))will always return A, B, CIt seemed like a way to get around the many-to-many restrictions with out having to build a new view