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
Anonymous
Not applicable

need help getting count of "ID" within another ID's count DAX HELP

Hi,

 

    I have a relationship between two tables, a "DEV" table and "CONTRACT" table. There are Development ID's and Contract ID's. Each Contract has a Dev ID. 

I've created a measure that shows current "OPEN Dev's" in the last 30 days. Now, I want to show how many CONTRACTS are created within those "OPEN Dev's". How can I handle this in a measure? I need the total of CONTRACTS created within those OPEN devs within the last 30 days. 

 

Measure that gets count of "OPEN DEV's in Last 30days":

 

L30DaysDev = CALCULATE(count('dw DimDevelopment'[DevelopmentID]),filter(all('dw DimDevelopment'),'dw DimDevelopment'[DevCreatedDate].[Date] >= TODAY()-30),filter(all('dw DimDevelopment'),'dw DimDevelopment'[DevIsClosed]="Open"),filter(all('dw DimDevelopment'),'dw DimDevelopment'[DevParentID]=blank()))

 

Below is the SQL Script that gets me the right count(without the last 30days filter), although it is grouped by the devID (which I dont want, I just need to get the total count).

select D.dimdevelopmentkey, count(F.dimcontractscopekey)  from dw.FactContractScope as F right join dw.dimdevelopment as D on F.dimdevelopmentkey = D.dimdevelopmentkey where d.devisclosed = 'Open'  group by D.dimdevelopmentkey

 

Any help would be greatly appreciated. Thanks!!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thank you for getting back to me. However, I figured out the solution myself. Thank you anyway.

View solution in original post

2 REPLIES 2
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

Could you please share your sample data and excepted result to me if you don't have any Confidential Information.Please upload your files to One Drive and share the link here.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

Thank you for getting back to me. However, I figured out the solution myself. Thank you anyway.

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.