Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

How to create a measure that returns specific values from a column?

I want to use it as a slicer. I'm using direct query (Tabular) and cannot add custom columns to the model, so i can use measures only.

I want the slicer to include values from column A, but only those that exist in column B, which is a column from a different table.

Please help.

29 Replies

  • Hi Anonymous 

     

    It's not possible to use a measure in a slicer.

    I understand you're not able to add calculated columns but are you able to add a calculated table?

     

    Best regards,
    Martyn


    If I answered your question, please help others by accepting it as a solution.

    • Anonymous's avatar
      Anonymous
      Not applicable
      Hi MartynRamsden

      What do you mean by calculated table?
      His do i do that in pbi?
      • MartynRamsden's avatar
        MartynRamsden
        Icon for Solution Sage rankSolution Sage

        Hi Anonymous 

         

        Go the Modeling tab, then click 'New table'. You'll then need to enter a DAX expression for new table.

        Your expression could be something like this:

         

        NewTable = 
        FILTER( 
            ALL( Table1[ColumnA] ),
            Table1[ColumnA] IN VALUES( Table2[ColumnB] )
        )

         

        This new table would contain a single column containing the values from ColumnA in Table1 that also exisit in ColumnB in Table2.

        You can then use the new column as a slicer in your report.

         

        Note: since there are no relationships to the new table, your measures will need to reference the new column (probably using TREATAS, VALUES or SELECTEDVALUE) so the slicer selction can be taken into account.

         

        There are plenty of resources available about how to use disconnected slicers. Here are a few:

         

        Best regards,
        Martyn


        If I answered your question, please help others by accepting it as a solution.