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
Anonymous
Not applicable

Filter Table based on Slicer Selection

 

Hi,

 

I've got a table that I want to filter based on what a Slicer selection returns.

 

The context is that I have a slicer table that looks like this:

MIN VIEWS
100

150

200

250

 

The customer should be able to pick one of the MIN VIEWS through the slicer and be returned a table with only the rows which are over the selected amout of Views.

 

 

My code looks like this:

Filtered Table = CALCULATETABLE('datatable'), FILTER('datatable', 'datatable'[Visits] > SELECTEDVALUE('MIN Views'[MIN VIEWS])  )  )

 

 

The selection works, as you can see below, however the filter won't work (e.g. all rows from the datatable are displayed in the new table.

Capture4.PNG

 

 

 

 

 

 

Thanks in advance,

Leon

1 ACCEPTED SOLUTION

@Anonymous add measure as below and in table visual, drop product and this new measure, you will have solution

 

Views Total = 
VAR __selectedValue = SELECTEDVALUE( Table2[MinViews] )
RETURN 
CALCULATE( 
SUM( Table3[Views] ), 
Table3[Views] >= __selectedValue
 )


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

10 REPLIES 10
parry2k
Super User
Super User

@Anonymous you cannot use slicer value in calculatetable, you need to create measure and use that in a table visual to show the data.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable


@parry2k wrote:

@Anonymousyou cannot use slicer value in calculatetable, you need to create measure and use that in a table visual to show the data.


Hi Parry,

 

thanks for your reply.

 

Unfortunately I do not quite understand what you mean with creating a measure and using that in a table visual.

 

I just created a Measure that gives me the selected views, and tried using that as a filter instead - it didn't work either. Can you explain a bit more in depth?

 

Thank you for your help!

 

Leon

@Anonymous it will be much easier to provide an answer if you post sample data with expected output.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable


@parry2k wrote:

@Anonymousit will be much easier to provide an answer if you post sample data with expected output.


@parry2k Thats a good Idea. So I have this table:

 

MIN VIEWS
100

150

200

250

 

and this table.

Product IDViews
1500
2300
3450
430
520

 

My expected Output is a new table, that dependant on some form of selection tool, gives me this output:

 

Capture3.PNG

 

 

Product IDViews
1500
3450

 

 

Thanks,

Leon

 

@Anonymous add measure as below and in table visual, drop product and this new measure, you will have solution

 

Views Total = 
VAR __selectedValue = SELECTEDVALUE( Table2[MinViews] )
RETURN 
CALCULATE( 
SUM( Table3[Views] ), 
Table3[Views] >= __selectedValue
 )


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hi All, 

 

I am having the same issue and fairly new to dax. I am trying show the numbers based on the selected option in slicer and I am not getting any luck. 

 

So far, here is the dax that I have but incomplete: 

 

REGION Exp. Landing % vs 2023 Commit Filter =
VAR _selectedValue = SELECTEDVALUE('2023 Attainment Details Back Up'[User TP Selling Role])
RETURN
CALCULATE(([ATT GRID OVERALL S + V]+[SUM of 80% SFDC Projection]+[REGION Weighted Pipeline]),'2023 Attainment Details Back Up','2023 Attainment Details Back Up'[User TP Selling Role])
)

 

Anonymous
Not applicable


@parry2k wrote:

@Anonymousadd measure as below and in table visual, drop product and this new measure, you will have solution

 

Views Total = 
VAR __selectedValue = SELECTEDVALUE( Table2[MinViews] )
RETURN 
CALCULATE( 
SUM( Table3[Views] ), 
Table3[Views] >= __selectedValue
 )

@parry2k That works quite well, thank you. However when I add any other columns, new Products come into the table. Any chance I can prevent that? So then the output looks like this:

Product IDViews TotalPrice
150050
2 60
345010
4 22
5 12

 

I don't want 2,4,5 in the table though, because I'm working with and visualizing the numbers...

 

 

Thanks,

Leon

@Anonymous in visual level filter, in measure , choose great than zero.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hi i have more or less the same problem.. https://community.powerbi.com/t5/DAX-Commands-and-Tips/FILTER-TABLE-BASED-ON-SELECTED-VALUE/m-p/1075...

But it doesnt work for me this solution.

Can you help ?

Anonymous
Not applicable


@parry2k wrote:

@Anonymousin visual level filter, in measure , choose great than zero.


Thank you parry!!

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.