Forum Discussion

TheSweeper's avatar
TheSweeper
Icon for Helper I rankHelper I
4 years ago
Solved

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

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

 

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

7 Replies

      • amitchandak's avatar
        amitchandak
        Icon for Super User rankSuper User

        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 )

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

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