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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
sdb_utd
Frequent Visitor

Sum all earliest values by field

Hi,

 

I have an invoice table which contains a company name, a sale vaue and a date. There's also a filter column which users will toggle on the report.

 

I'm trying to get a few figures:

1. Difference between earliest and latest price per for each name. I have this as a measure called "Difference"

2. The overall percent change from first to last for all names. This should be -12.46%, and should be just sum of the Difference measure, but sum will not accept a measure. Any ideas?

 

Raw data example

NameValueFilterDate
United250y01/01/2020
MPC90y01/01/2020
SDB150y01/01/2020
FPL70n01/01/2020
CHEM80y01/01/2020
United50y02/01/2020
United80y03/01/2020
MPC1000y02/01/2020
MPC100y03/01/2020
MPC45n04/01/2020
SDB100y02/01/2020
SDB200y03/01/2020
FPL100y02/01/2020
FPL65y03/01/2020
CHEM500y02/01/2020
CHEM85y03/01/2020
United225y04/03/2020

 

Report example

NameFirstValueLastValueTotal Name values

Total all values

Percent total spendDifference%GT Difference
FPL706523531907.37-7.14%-3.23%
SDB150200450319014.1133.33%15.05%
United250225605319018.97-10.00%-4.52%
CHEM8085665319020.856.25%2.82%
MPC90451235319038.71-50.00%-22.58%
3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @sdb_utd,

Can you please provide your measure formula for test? If will help to test and modify your formula on sample data.

How to Get Your Question Answered Quickly  

In addition, you can also take a look at the following blog about measure total issue:

Measure Totals, The Final Word  

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

https://www.dropbox.com/s/ddvxc6y9psou0du/sample%20data.pbix?dl=0

 

I think I have this working now. My previous measure for summing the earliest and latest values was just summing the values at the earliest or latest date in the table, ie. summing all values for 01/01/2020 or all values for 04/03/2020, rather than the latest value for a name.

Sum of Total  at Latest Date = 
CALCULATE (
    SUM ( 'Table'[Value] ),
    FILTER (
        'Table',
        'Table'[Name]  = ( 'Table'[Name] )
        &&
        'Table'[Date]  = CALCULATE(MAX('Table'[Date]),ALLEXCEPT('Table','Table'[Name]))
           )
)
amitchandak
Super User
Super User

@sdb_utd ,

I did not get your last column. Rest of the cal is in file.https://www.dropbox.com/s/xc9lp45fx76j1do/FirstLastvalue.pbix?dl=0

 

I have used firstnonblankvalue and lastnonblankvalue, those are part of lastest release

 

Appreciate your Kudos.

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

Find out what's new and trending in the Fabric Community.