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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
alexburn
New Member

Latest data & sum of data

I have a table of data that has multiple entries per "Job".

I need to display a summary table that shows the latest entry for "Budget" but a sum of entries for "WIP".

Example data below:

 

Date----------Job---------Budget---------WIP---------
1/1/211111110,0000
2/1/211111110,00010
3/1/21111119,500-5
1/1/21222225,0000
2/1/21222226,00020
2/1/213333312,0000
3/1/213333311,000-20

 

Ultimately, I want to summarise this as follows (with red columns being Measurements):

 

Job---------Latest Date---------Latest Budget---------Sum of WIP---------
111113/1/219,5005
222222/1/216,00020
333333/1/2111,000-20

 

Any assistance would be appreciated, thank you.

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

Hi @alexburn,

 

Try these measures:

 

Latest Date = IF (HASONEVALUE ( Jobs[Job] ), MAX ( Jobs[Date] ) )

Latest Budget Calc = 
VAR vMaxDate = [Latest Date]
VAR vResult =
    CALCULATE ( MAX ( Jobs[Budget] ), Jobs[Date] = vMaxDate )
RETURN
    vResult

Latest Budget = 
VAR vTable =
    ADDCOLUMNS ( VALUES ( Jobs[Job] ), "@LatestBudget", [Latest Budget Calc] )
VAR vResult =
    SUMX ( vTable, [@LatestBudget] )
RETURN
    vResult

Sum of WIP = SUM ( Jobs[WIP] )

 

DataInsights_0-1614455189881.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
DataInsights
Super User
Super User

Hi @alexburn,

 

Try these measures:

 

Latest Date = IF (HASONEVALUE ( Jobs[Job] ), MAX ( Jobs[Date] ) )

Latest Budget Calc = 
VAR vMaxDate = [Latest Date]
VAR vResult =
    CALCULATE ( MAX ( Jobs[Budget] ), Jobs[Date] = vMaxDate )
RETURN
    vResult

Latest Budget = 
VAR vTable =
    ADDCOLUMNS ( VALUES ( Jobs[Job] ), "@LatestBudget", [Latest Budget Calc] )
VAR vResult =
    SUMX ( vTable, [@LatestBudget] )
RETURN
    vResult

Sum of WIP = SUM ( Jobs[WIP] )

 

DataInsights_0-1614455189881.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Many thanks @DataInsights 

Having just tried these measures, they seem to work exactly as required!

I'll continue to play around, but this does look like the exact solution I was looking for.

Many thanks!!!!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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