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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jessecrosswhite
New Member

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]) 
)

 

 

1 ACCEPTED SOLUTION
jessecrosswhite
New 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 

 

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

View solution in original post

3 REPLIES 3
jessecrosswhite
New 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 

 

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
jessecrosswhite
New 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 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
Greg_Deckler
Super User
Super User

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


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors