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
PBINewbie12
Employee
Employee

Sum of unique rows in one table using variables from a different table

Hello,

 

As my nane implies, I am new to PowerBI, but after some searching, I could not find the answer to this question.   Apologies if it is out there and I missed it!

 

I have a very large dataset that looks something like below. 

 

Requests for Assistance
RequestorDate
Dave2/4/2021
Suzy2/5/2021
Dave2/6/2021
Joe2/7/2021
Bill2/8/2021
Suzy2/9/2021
Tom2/10/2021
Frank2/11/2021
Jolene2/12/2021
Maggie2/13/2021
Suzy2/14/2021
Dave2/15/2021
Kathy2/16/2021

 

I want to be able to calculate the number of unique requests based on a table of VIP's (I don't need to know the quantity for each VIP, just how how many in this table are from VIP's.   That table looks like

 

VIP Requestors
Requestor
Suzy
Frank

 

In this example, the measure should return 4.

 

Appreciate your help in understanding how to do this!

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

There are lots of ways to do this.

 

Here are a couple:

COUNTROWS (
    FILTER ( Requests, Requests[Requestor] IN VALUES ( VIPs[Requestor] ) )
)

 

CALCULATE (
    COUNT ( Requests[Requestor] ),
    TREATAS ( VALUES ( VIPs[Requestor] ), Requests[Requestor] )
)

View solution in original post

3 REPLIES 3
AlexisOlson
Super User
Super User

There are lots of ways to do this.

 

Here are a couple:

COUNTROWS (
    FILTER ( Requests, Requests[Requestor] IN VALUES ( VIPs[Requestor] ) )
)

 

CALCULATE (
    COUNT ( Requests[Requestor] ),
    TREATAS ( VALUES ( VIPs[Requestor] ), Requests[Requestor] )
)

That was super helpful Alexis!   Thank you very much.

Whitewater100
Solution Sage
Solution Sage

Hi PBINewbi:

Don't worry, in the beginning all this seems confusing. I have put together an appropriate data model (based on what you wrote) and added supporting tables. The solution is done in both a calculated column and measure.

I will attach file for your review. There's usually more than one way to get to a result.

I hope you can accept as a solution. Thanks..https://drive.google.com/file/d/1i9COJVf8XcwtYkaB6a70RpqA_vhJDQ0z/view?usp=sharing 

 

Whitewater100_0-1653094429030.png

 

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.

Top Solution Authors