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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
khacwee
Frequent Visitor

How to get Document number that contains Item A, while keep other row info?

Hi all, I have Table A below:

 

Doc NumberItem
No.1A
No.1B
No.2A
No.3B
No.3C
No.4A
No.4C

I would like to get the Document number that contains item A,

but if i filter this table with ITEM = "ITEM A", the result will be:

 

Doc NumberItem
No.1A
No.2A
No.4A

 



However, My desired output is the table to filter Doc number that contains Item A, so the output will still display Doc No.1 with Item B.

 

Doc NumberItem
No.1A
No.1B
No.2A
No.4A
No.4C

 

I have tried with countrows filtering which does not work, any advice?

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

You could create a measure like

Document is visible =
VAR CurrentDocument =
    SELECTEDVALUE ( 'Table A'[Document number] )
VAR DocsWithItemA =
    CALCULATETABLE (
        VALUES ( 'Table A'[Document number] ),
        REMOVEFILTERS (),
        'Table A'[Item] = "A"
    )
RETURN
    IF ( CurrentDocument IN DocsWithItemA, 1 )

and use that as a visual level filter on your table

View solution in original post

2 REPLIES 2
johnt75
Super User
Super User

You could create a measure like

Document is visible =
VAR CurrentDocument =
    SELECTEDVALUE ( 'Table A'[Document number] )
VAR DocsWithItemA =
    CALCULATETABLE (
        VALUES ( 'Table A'[Document number] ),
        REMOVEFILTERS (),
        'Table A'[Item] = "A"
    )
RETURN
    IF ( CurrentDocument IN DocsWithItemA, 1 )

and use that as a visual level filter on your table

Thanks ! work like charm!

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.