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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
LATH
Frequent Visitor

Return True when the row in Column is True and if the row is selected by a slicer.

Hello, 

I have a little problem, where I cannot seem to find the answer to. 

I have one table with all the Information in it, and in that Table is a Column, that has TRUE or FALSE values in it. Further there is an ID Column, that is used in a Slicer. 

Now to the Problem. I want to show in a Table all the vaules that are marked TRUE plus the values, that are selected in an ID slicer. 

 

So I expect the following Result when ID 2 & 3 are selected in the Slicer:

IDTrue/False Colum Expected Result
1TrueTrue
2TrueTrue
3False True
4False False

 

I tried it with some versions of the following code but I cannot get it to work:

ShowRow =
VAR Always = SELECTEDVALUE('OfflineExcel'[AV_Marked]) = TRUE()
VAR IsSelected =
    CONTAINS(
        VALUES('OfflineExcel'[Av_Text_Combined]),
        'OfflineExcel'[Av_Text_Combined],
        SELECTEDVALUE('OfflineExcel'[Av_Text_Combined])
    )
RETURN Always || IsSelected

And there can be syntax errors in that Code, because of frustration I deleted the DAX 😅 and I recreated it here out of memory.

 

Thanks and best regards

Lars

2 ACCEPTED SOLUTIONS
johnt75
Super User
Super User

You will need a separate, disconnected table to use in the slicer. You can create one with something like

Table for Slicer = DISTINCT( 'Table'[ID] )

Do not connect the new table to the main table.

Now you can create a measure like

Show Row =
IF (
    SELECTEDVALUE ( 'OfflineExcel'[AV_Marked] )
        || SELECTEDVALUE ( 'OfflineExcel'[ID] ) IN VALUES ( 'Table for slicer'[ID] ),
    1
)

Add that as a filter to your table or matrix visual, set to show only when the value is 1.

View solution in original post

That's why you need the disconnected table for the slicer. Making any selection in the slicer should not affect the table at all, unless you place a measure filter on the table.

To be clear, the slicer needs to use the disconnected table, the table visual should use values from the main table.

View solution in original post

6 REPLIES 6
johnt75
Super User
Super User

You will need a separate, disconnected table to use in the slicer. You can create one with something like

Table for Slicer = DISTINCT( 'Table'[ID] )

Do not connect the new table to the main table.

Now you can create a measure like

Show Row =
IF (
    SELECTEDVALUE ( 'OfflineExcel'[AV_Marked] )
        || SELECTEDVALUE ( 'OfflineExcel'[ID] ) IN VALUES ( 'Table for slicer'[ID] ),
    1
)

Add that as a filter to your table or matrix visual, set to show only when the value is 1.

LATH
Frequent Visitor

Hello John,

Thanks for your response as well. However, this also does not work. The Problem now is, that when the table and the Slicer interact with each other, and in the slicer a row is selected, only that row is shown in the Table. It should show that value and all the others marked true.

When I turn of the interaction, the all the values are shown, and the slicer does not work.

That's why you need the disconnected table for the slicer. Making any selection in the slicer should not affect the table at all, unless you place a measure filter on the table.

To be clear, the slicer needs to use the disconnected table, the table visual should use values from the main table.

LATH
Frequent Visitor

Thank you, John, for the Answer, that did Work 👍

bhanu_gautam
Super User
Super User

@LATH , Try using

DAX
ShowRow =
VAR Always = 'OfflineExcel'[True/False Column] = TRUE()
VAR IsSelected =
COUNTROWS(
FILTER(
ALLSELECTED('OfflineExcel'),
'OfflineExcel'[ID] = EARLIER('OfflineExcel'[ID])
)
) > 0
RETURN Always || IsSelected




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Hello Bhanu,

thanks for the Quick rsponse. However, if it is a measure, it does not work, since earlier is not a measure object. And when I tried it in a new Row I get the full amount as true which should which should not be the case.

Thanks 

Lars

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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