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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
anwarbi
Helper III
Helper III

Create a filtered table from another table using slicer value

Hi,
 
I am trying to create a filtered table from a bigger table in the power bi report using DAX,  I am trying to create new table from the data modelling by using the below measure. 
 
I want the table to be dynamically filtered based on the selected values in the slicer, however the table is not returning me any values, it is blank.
 
The below dax seems to be incorrect, can you please let me know what would be the correct way of using this. 
 
Also please note that since I want to use slicer in the report to filter the table, hence I do want to do this filtering in query editor. 
 
Filtered standard table =
VAR SelectedCompany = AllSELECTED('Standard list -2022'[Company])
return
FILTER('Standard list -2022','Standard list -2022'[Company]= SelectedCompany)
 
The sample data is as below:
 
CountryStateCompany
USNYABC
USTexasABC
CanadaBCXYZ
CanadaTorontoLMN
CanadaVancouverPQR
CanadaBCSTU
GermanyBerlinHIJ
 
So, in the slicer if i select Company "ABC" then i should get a filtered table as below:
 
 
CountryStateCompany
USNYABC
USTexasABC

 

Thanks for your help.

1 ACCEPTED SOLUTION

Hi @anwarbi ,

 

You can store data in the database, using the direct query connection mode. Then create a new parameter, modify the advance editor as shown below, save and close, we can create a table and then bind the parameter to the field. The result is shown in the figure below. At this time the slicer will filter the data source data, but because it is a direct connection we can not see the data on the data view. Dynamic M query parameters will have some restrictions please refer to the documentation for details.

vtangjiemsft_0-1686039277498.pngvtangjiemsft_1-1686039317325.png

 

Table = UNION(VALUES(TESTTABLE[Company]),{"ALL"}) 

 

vtangjiemsft_2-1686039370876.png

 

Best Regards,

Neeko Tang

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-tangjie-msft
Community Support
Community Support

Hi @anwarbi ,

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) We can create a table and a measure. 

Table 2 = 'Table'
Flag = IF(MAX('Table 2'[Company])=SELECTEDVALUE('Table'[Company]),1,0)

(3) Then the result is as follows.

vtangjiemsft_0-1685930952626.png

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

Hi,

 

I don't really want to add a filter at a visual level but I need to filter the underlying data table (please refer screenshot) of the data table when filtered manually. This is the filtered result I need at a data level by selecting a company name through slicer.

 

sample data.png

 

Thanks

 

Hi @anwarbi ,

 

You can store data in the database, using the direct query connection mode. Then create a new parameter, modify the advance editor as shown below, save and close, we can create a table and then bind the parameter to the field. The result is shown in the figure below. At this time the slicer will filter the data source data, but because it is a direct connection we can not see the data on the data view. Dynamic M query parameters will have some restrictions please refer to the documentation for details.

vtangjiemsft_0-1686039277498.pngvtangjiemsft_1-1686039317325.png

 

Table = UNION(VALUES(TESTTABLE[Company]),{"ALL"}) 

 

vtangjiemsft_2-1686039370876.png

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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