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
earltom
Frequent Visitor

Get multiple rows for slicer for selected value - Date

Hi

Trust you experts can help me

 

We have stores that we supply goods to and it often happens that stores are sold and then change name, if users we run a Report we like to see the Stores name as per the date it was run.

 

I can display the latest Store name using max measure, how can I display all the stores in the Visual as a Filter.

Dax only returns one value and not mulitple stores

 

FACT

MonthStore IDSales
Mar 311110k
April 301111k
May 3111112k

 

STORE

 

Store IDStore nameMonth
11JudysMar 31
11JudysApril 30
11Judys & DaveMay 31

 

 

 

1 ACCEPTED SOLUTION
v-binbinyu-msft
Community Support
Community Support

Hi @earltom ,

Please try below steps

1.my test table

FACT:

vbinbinyumsft_0-1661502029068.png

STORE:

vbinbinyumsft_1-1661502048604.png

Model:

vbinbinyumsft_2-1661502080217.png

 

2. add a slicer , card visual, create a measure and  add it to card

Store Name For Month =
VAR cur_month =
    SELECTEDVALUE ( STORE[Month] )
VAR cur_id =
    SELECTEDVALUE ( STORE[Store ID] )
VAR tmp =
    FILTER ( ALL ( STORE ), STORE[Store ID] = cur_id && STORE[Month] <= cur_month )
VAR final =
    CONCATENATEX ( tmp, [Month] & " " & [Store name], "
" )
RETURN
    final

Animation6.gif

Please refer attached .pbix file.

 

Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-binbinyu-msft
Community Support
Community Support

Hi @earltom ,

Please try below steps

1.my test table

FACT:

vbinbinyumsft_0-1661502029068.png

STORE:

vbinbinyumsft_1-1661502048604.png

Model:

vbinbinyumsft_2-1661502080217.png

 

2. add a slicer , card visual, create a measure and  add it to card

Store Name For Month =
VAR cur_month =
    SELECTEDVALUE ( STORE[Month] )
VAR cur_id =
    SELECTEDVALUE ( STORE[Store ID] )
VAR tmp =
    FILTER ( ALL ( STORE ), STORE[Store ID] = cur_id && STORE[Month] <= cur_month )
VAR final =
    CONCATENATEX ( tmp, [Month] & " " & [Store name], "
" )
RETURN
    final

Animation6.gif

Please refer attached .pbix file.

 

Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@earltom , If the Month and Store ID are always available then you can have combined key in both tables and join

 

key = [Store ID] & "-" & [Month]

 

Join both tables on this Store to Fact 1-M

 

if dates/month in store are not regular. then we need have dates using month 

and add a new column to fact  (Add an index column in store table in power query)

 

New column in fact =

var _date = maxx(filter(Store, Store[Date] > fact[Date] && Store[Store ID] = fact[Store ID]) , Store[Date])

return

maxx(filter(Store, Store[Date] =_max && Store[Store ID] = fact[Store ID]) , Store[Index])

 

Join both table on index

 

Power Query- Index Column: https://youtu.be/NS4esnCDqVw

Are we joining on key = [Store ID] & "-" & [Month] or the Index Column or both? 

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.