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
Brycert
Resolver I
Resolver I

Getting additional attributes from TOPN measure returns dreaded "Exceeded resources error"

Greetings all,

 

I have a very simple model:

 

Brycert_0-1632505964438.png

 

 

What I am wanting to do is calculate Claims Count of Claims Paid (a measure) against the TOP 10 NDCs that are in the DrugInformation table as well as the Claim table (1 To many from Claims to Druginformation). So this measure:

 

Top 10 NDC Claim Count Paid = var ranking = VALUES(DrugInformation[NDC]) return CALCULATE(Claim_Measures[Count of Claims Paid], TOPN(10,ALLSELECTED(DrugInformation[NDC]),Claim_Measures[Count of Claims Paid], DESC), ranking)
 
seems to work fine, I can add The ChainName, as well as the NDC from the Druginformation table like this:
 
Brycert_1-1632506160373.png

 

 However, when I add an additional attribute (Drugname) coming from the DrugInformation table, I get an error that the available resources have been exceeeded. What am I doing wrong? NDC is the primary key in DrugInformation, so I would expect that adding a nonkey attribute would be no issue. 
1 ACCEPTED SOLUTION
Brycert
Resolver I
Resolver I

I found the issue, the values clause should contain the whole table in the Calculate function:

 

Top 10 NDC Claim Count Paid = var ranking = VALUES(DrugInformation[NDC]) return CALCULATE(Claim_Measures[Count of Claims Paid], TOPN(10,ALL(DrugInformation),Claim_Measures[Count of Claims Paid], DESC), ranking)

View solution in original post

2 REPLIES 2
Brycert
Resolver I
Resolver I

I found the issue, the values clause should contain the whole table in the Calculate function:

 

Top 10 NDC Claim Count Paid = var ranking = VALUES(DrugInformation[NDC]) return CALCULATE(Claim_Measures[Count of Claims Paid], TOPN(10,ALL(DrugInformation),Claim_Measures[Count of Claims Paid], DESC), ranking)

Brycert
Resolver I
Resolver I

Let me also add that these "Drug Names" are not unique in the Drug Information table. But I wouldnt expect that to be an issue as the NDC corresponds to that exact Drug Name. Just an FYI however.

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