cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
JChris
Helper II
Helper II

How to count rows using another related table as filter?

I have two tables that are linked:

 

  1. Software (UniqueID, Name, Vendor)
  2. Status (UniqueID, Status, Description)

 

The link between them is UniqueID. I want to create a Measure where I count the total of rows in Software which the Status.Status is "AUTHORIZED". How can I do that?

 

1 ACCEPTED SOLUTION
malagari
Responsive Resident
Responsive Resident

 

There are a few ways you can do this, depending on how your relationships directions are set up.

 

Option 1

 

MeasureName = 
CALCULATE(
   COUNTROWS(Software),
   FILTER(Software, RELATED(Status[Status]) = "AUTHORIZED)
)

--- OR ---
MeasureNameOptimized = CALCULATE( COUNTROWS( FILTER(Software, RELATED(Status[Status]) = "AUTHORIZED") ) )

 

Option 2

 

 

MeasureName = 
CALCULATE(
   COUNTROWS(Software),
   FILTER(Status, Status[Status] = "AUTHORIZED")
)

 

Dan Malagari
Consultant at Headspring

View solution in original post

1 REPLY 1
malagari
Responsive Resident
Responsive Resident

 

There are a few ways you can do this, depending on how your relationships directions are set up.

 

Option 1

 

MeasureName = 
CALCULATE(
   COUNTROWS(Software),
   FILTER(Software, RELATED(Status[Status]) = "AUTHORIZED)
)

--- OR ---
MeasureNameOptimized = CALCULATE( COUNTROWS( FILTER(Software, RELATED(Status[Status]) = "AUTHORIZED") ) )

 

Option 2

 

 

MeasureName = 
CALCULATE(
   COUNTROWS(Software),
   FILTER(Status, Status[Status] = "AUTHORIZED")
)

 

Dan Malagari
Consultant at Headspring

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors