Forum Discussion

anwarbi's avatar
anwarbi
Helper III
3 years ago
Solved

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.

  • Anonymous's avatar
    Anonymous
    3 years ago

    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.

     

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

     

     

    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. 

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    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.

    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. 

    • anwarbi's avatar
      anwarbi
      Helper III

      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.

       

       

      Thanks

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        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.

         

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

         

         

        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.