Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.