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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
anwarbi
Helper II
Helper II

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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