Forum Discussion

Brycert's avatar
Brycert
Resolver I
4 years ago
Solved

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

Greetings all,

 

I have a very simple model:

 

 

 

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:
 

 

 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. 
  • 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)

2 Replies

  • 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.

  • 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)