Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Solved! Go to Solution.
@willit6182 Not 100% sure I understand this. Sample data would help but perhaps something like this:
Column =
VAR __ID = [EncounterID]
VAR __Codes = SELECTCOLUMNS( FILTER( 'Table 3', [EncounterID] = __ID ), [Procedure Code] )
VAR __MaxRVU = MAXX( FILTER( 'Table 2', [Procedure Code] IN __Codes ), [RVU] )
VAR __Result = MAXX( FILTER( 'Table 2', [Procedure Code] IN __Codes && [RVU] = __RVU ), [Procedure Description (groups) )
RETURN
__Result
@willit6182 Not 100% sure I understand this. Sample data would help but perhaps something like this:
Column =
VAR __ID = [EncounterID]
VAR __Codes = SELECTCOLUMNS( FILTER( 'Table 3', [EncounterID] = __ID ), [Procedure Code] )
VAR __MaxRVU = MAXX( FILTER( 'Table 2', [Procedure Code] IN __Codes ), [RVU] )
VAR __Result = MAXX( FILTER( 'Table 2', [Procedure Code] IN __Codes && [RVU] = __RVU ), [Procedure Description (groups) )
RETURN
__Result
Thanks but I'm still not quite getting it to work.
To simply the dataset, I now have one larger table as below. This has multiple instances of the Encounter ID, each with a distinct Procedure Code.
| EncounterID | Procedure Code | RVU Value |
| 102247204 | 20225 | 2.45 |
| 102247204 | 7701226 | 1.5 |
| 104241596 | 38222 | 1.44 |
| 104241596 | 99152 | 0.25 |
| 104241596 | 7701226 | 1.5 |
| 110248074 | 36590 | 3.1 |
| 110248074 | 99152 | 0.25 |
| 110248074 | 7700126 | 0.38 |
| 123243462 | 7660426 | 0.59 |
| 129245185 | 32555 | 2.27 |
| 1012415987 | 32555 | 2.27 |
| 1022429872 | 49406 | 4 |
| 1022429872 | 99152 | 0.25 |
| 1022445014 | 50706 | 3.8 |
| 1022445014 | 99152 | 0.25 |
| 1022445014 | 50431 | 1.1 |
| 1022445014 | 50389 | 1.1 |
I also have a second KEY table that lists every possible Procedure Code only once, with a corresponding Category as below.
| Procedure Code | Category |
| 10005 | Minors |
| 10006 | Minors |
| 10030 | Visceral Tubes |
| 20206 | Biopsy |
| 20220 | Biopsy |
| 20225 | Biopsy |
| 20501 | Fluoro |
| 20552 | Fluoro |
| 22510 | Kyphoplasty |
| 22513 | Kyphoplasty |
| 22514 | Kyphoplasty |
| 22515 | Kyphoplasty |
| 32408 | Biopsy |
| 32550 | Visceral Tubes |
| 36010 | Catheter, Angio, Guidance, Sedation |
| 36012 | Catheter, Angio, Guidance, Sedation |
I am trying to create a measure that classifies each Distinct Encounter ID by the Category of the Procedure Code with the largest RVU value. In the first table above, the highest RVU value procedure code from each Encounter ID is highlighted in Red. So basically I need that Encounter ID to be classified as the Category on the second table linked to the Procedure code in Red.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 9 | |
| 5 | |
| 5 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 22 | |
| 10 | |
| 9 | |
| 7 | |
| 6 |