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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
moosepng
Helper II
Helper II

New table with with DISTINCT IDs and TRUE condition

How do I create a table with unique values [ID] where a condition ([Status] = A) is TRUE?

I have a Table where each row has a unique DateTime:

DateTimeIDStatus
25/10/2020 14:251001A
29/10/2020 14:251001B
1/12/2020 15:301002 
5/02/2021 12:001001B
15/04/2021 21:451002B
20/04/2021 21:451003A


I want to create a table with a List of DISTINCT IDs where Status = A
My expected result is:

ID
1001
1003


What I have so far is:

 

New_Table = 
FILTER(
    DISTINCT( Table[ID]),
    'Table'[Status] = "A"
)

 


The error I get is: "Column 'Housing' in table 'StatusChangeMerged' cannot be found or may not be used in this expression."

I get it, I don't include the [Status] in my new table, so it can't be found.

How do I inculde [Status} in my new table? Or how do I evaluate the FilterExpression on another table?

2 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Hi, @moosepng 

Please try the below for creating a new table.

 

New_Table =
SUMMARIZE ( FILTER ( 'Table', 'Table'[Status] = "A" ), 'Table'[ID] )

 

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

Hi, @moosepng 

Please try the below.

 

New_Table never had A =
EXCEPT (
VALUES ( 'Table'[ID] ),
SUMMARIZE ( FILTER ( 'Table', 'Table'[Status] = "A" ), 'Table'[ID] )
)
 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

6 REPLIES 6
RJ251997
Helper I
Helper I

Hi @moosepng ,

 

you can try this

DISTINCTCOUNT (TblName[itemnumber] );TblName[Status]="Open")

Thank & Regards 

Rohit Jaiswal

 

Jihwan_Kim
Super User
Super User

Hi, @moosepng 

Please try the below for creating a new table.

 

New_Table =
SUMMARIZE ( FILTER ( 'Table', 'Table'[Status] = "A" ), 'Table'[ID] )

 

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


How would you create a table with all values that have never had a status = A?
With result:

ID
1002

 


I though

New_Table =
SUMMARIZE ( FILTER ( 'Table', 'Table'[Status] <> "A" ), 'Table'[ID] )


But this returns

ID
1001
1002


because ID 1001 has also had Status = B

Hi, @moosepng 

Please try the below.

 

New_Table never had A =
EXCEPT (
VALUES ( 'Table'[ID] ),
SUMMARIZE ( FILTER ( 'Table', 'Table'[Status] = "A" ), 'Table'[ID] )
)
 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Replying to my own message just in case anyone stubles on this one.

NOT ( Table1[ID] IN VALUES ( Table2[ID] ) ) 

this worked to select IDs not selected in my New Table. got the solution from here: https://community.powerbi.com/t5/Desktop/Cross-filter-to-exclude/td-p/1448337

Thanks again. I'm getting better I swear

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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