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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
TheSweeper
Helper I
Helper I

Amateur Needing Help with Calculated Measure

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!!!!!

Measure.png

IsLatest =
VAR charge_id = Charges[Charge ID]
VAR latest_charge_id_date =
CALCULATE(
MAX(Charges[Charge Last Modified Date]),
ALL(Charges),
Charges[Charge ID] = charge_id
)

RETURN
IF(
Charges[Charge Last Modified Date] = latest_charge_id_date,
TRUE(),
FALSE()
)
Total ChargeMRNCharge IDCharge Line IDAcct DateCPTLast Modified DateLine NumberIs Latest
5763930806382644/1/22Q99674/1/222

False

5763930806382644/1/22Q99674/5/222

False

5763930806382644/1/22Q99674/20/222

False

956.723930806482654/1/22767004/1/221

False

956.723930806482654/1/22767004/5/221

False

956.723930806482654/1/22767004/20/221

True

 

Example Report.png

1 ACCEPTED 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 )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

7 REPLIES 7
TheSweeper
Helper I
Helper I

Woohooo I figured it out

 

@amitchandak Thank you so much for your help!

 

I  used this formula to return the correct total. 

 

SUMX(SUMMARIZE(Charges, Charges[Charge Line ID], "Last Mod Charge", [Measure]), [Last Mod Charge])
TheSweeper
Helper I
Helper I

@DataInsights 

 

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

@DataInsights - I figured it out 🙂

PezzPower
New Member

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 )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak 

 

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. 

Correct Measure_Need Correct Total.png

Measure =
VAR __id = MAX ('Charges'[Charge Line ID])
VAR __date = CALCULATE ( MAX('Charges'[Charge Last Modified Date] ), ALLSELECTED ('Charges' ), 'Charges'[Charge Line ID] = __id )
return
CALCULATE ( Sum ('Charges'[Total Charge] ), VALUES ('Charges'[Charge Line ID] ),'Charges'[Charge Line ID] = __id,'Charges'[Charge Last Modified Date] = __date )
 
Again, truly appreciate your help!
Sincerely,
Amanda Cross

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.