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!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Can someone kindly help me with this calculated measure?
I am trying to get this measure not to exclude Line 2 Charge Amount Totals. The sum for Charge Line ID 8264 should be $576. My measure doesn't take into account some Charges may be on Line 2, 3, etc.
Here is my current measure. Thank you in advance!!!!!
| Total Charge | MRN | Charge ID | Charge Line ID | Acct Date | CPT | Last Modified Date | Line Number | Is Latest |
| 576 | 3930 | 8063 | 8264 | 4/1/22 | Q9967 | 4/1/22 | 2 | False |
| 576 | 3930 | 8063 | 8264 | 4/1/22 | Q9967 | 4/5/22 | 2 | False |
| 576 | 3930 | 8063 | 8264 | 4/1/22 | Q9967 | 4/20/22 | 2 | False |
| 956.72 | 3930 | 8064 | 8265 | 4/1/22 | 76700 | 4/1/22 | 1 | False |
| 956.72 | 3930 | 8064 | 8265 | 4/1/22 | 76700 | 4/5/22 | 1 | False |
| 956.72 | 3930 | 8064 | 8265 | 4/1/22 | 76700 | 4/20/22 | 1 | True |
Solved! Go to Solution.
@TheSweeper , Try a measure like
Measure =
VAR __id = MAX ('Table'[Charge Line ID] )
VAR __date = CALCULATE ( MAX('Table'[Charge Last Modified Date] ), ALLSELECTED ('Table' ), 'Table'[Charge Line ID] = __id )
return
CALCULATE ( Sum ('Table'[Total Charge] ), VALUES ('Table'[Charge Line ID] ),'Table'[Charge Line ID] = __id,'Table'[Charge Last Modified Date] = __date )
Woohooo I figured it out
@amitchandak Thank you so much for your help!
I used this formula to return the correct total.
If you have time do you mind taking a stab at this? Unfortunately I can't continue building my report without this formula being completely correct in its output. 😞
Also an amateur, but does using filter within the CALC help you here?
https://community.powerbi.com/t5/Desktop/DAX-Calculate-the-Max-for-a-Group/td-p/64645
I tried but it didn't work. Thank you though!
@TheSweeper , Try a measure like
Measure =
VAR __id = MAX ('Table'[Charge Line ID] )
VAR __date = CALCULATE ( MAX('Table'[Charge Last Modified Date] ), ALLSELECTED ('Table' ), 'Table'[Charge Line ID] = __id )
return
CALCULATE ( Sum ('Table'[Total Charge] ), VALUES ('Table'[Charge Line ID] ),'Table'[Charge Line ID] = __id,'Table'[Charge Last Modified Date] = __date )
Your measure now gives me the correct data just the incorrect total. Truly appreciate your help!!!
Any suggestions on how I can show the correct total? 576+956.72+1,6803.96 = $3,213.68
I added the new measure below the screenshot.
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 64 | |
| 51 | |
| 46 | |
| 23 | |
| 19 |
| User | Count |
|---|---|
| 138 | |
| 111 | |
| 50 | |
| 33 | |
| 29 |