cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MISgirlNY Frequent Visitor
Frequent Visitor

Need help with a measure

Hello, Power BI community, need some help. I have two tables :

Table1 and Table2 both with fields ID (Unique in each table) and Date (date format).  

Need to count how many IDs from Table2 are in Table1 with Table1.Date < '1/1/2019'

Any help is greatly appreciated!!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Need help with a measure

Hi @MISgirlNY 

Try this measure in a card visual:

Measure =
COUNTROWS (
    INTERSECT (
        CALCULATETABLE ( DISTINCT ( Table1[ID] ), Table1[Date] < DATE ( 2019, 1, 1 ) ),
        DISTINCT ( Table2[ID] )
    )
)

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Cheers  Datanaut

View solution in original post

3 REPLIES 3
Highlighted
Super User
Super User

Re: Need help with a measure

Hi @MISgirlNY 

Try this measure in a card visual:

Measure =
COUNTROWS (
    INTERSECT (
        CALCULATETABLE ( DISTINCT ( Table1[ID] ), Table1[Date] < DATE ( 2019, 1, 1 ) ),
        DISTINCT ( Table2[ID] )
    )
)

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Cheers  Datanaut

View solution in original post

MISgirlNY Frequent Visitor
Frequent Visitor

Re: Need help with a measure

Thank you! Good idea! I've done it differently, linked two tables by ID. But I like INTERSECT better!  

Nathaniel_C Super Contributor
Super Contributor

Re: Need help with a measure

Hi @MISgirlNY ,

 

 

Let me know if you have any questions.

 

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel

 

 

Date less than and in table 2 = Calculate(Count(T1[ID]) , FILTER(T1,T1[ID]=LOOKUPVALUE(T2[ID],T2[ID],T1[ID] ) && T1[Date]<Date(2019,1,3)  ))

 

 

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Users Online
Currently online: 508 members 4,695 guests
Please welcome our newest community members: