Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hello,
I have tried various functions and have not been able to come up with a solution to this.
I have a series of reports that are submitted with a number of projects (reference number). I need to track the latest EFC across time at a reference number level.
I have tried numerous methods, one of which is:
var test3XX =
SUMX(
SUMMARIZE('Prog report data',
'Prog report data'[Reference Number],"Reference number",
CALCULATE(SUM('Prog report data'[Estimated Final Cost]),
USERELATIONSHIP('Date'[Date],'Prog report data'[Lodgement date]),
FILTER('Prog report data','Prog report data'[Lodgement date]=MAX('Prog report data'[Lodgement date])),
FILTER(ALL('Date'[Date]),'Date'[Date]<=MAX('Date'[Date])),
FILTER(ALL('Date'[Date]),'Date'[Date]<>BLANK())
)),
[Reference number]
)
The issue seems to be that all the functions only return ONE MAX/LATEST date - so when filtering on a project (reference) it is ok, however, when slicing and dicing at an aggregated level, it doesnt recognise the latest lodgement date for each reference number.
The data looks something like this (redacted).
Reference Number | Report Number | Lodgement date | Estimated Final Cost |
ABC.0002.1819I.SXG | ABC.PR03.1819.SXG | 09/04/2020 | $ 111,111.11 |
ABC.0002.1819I.SXG | ABC.PR01.1819.SXG | 11/02/2020 | $ 111,111.11 |
ABC.0002.1819I.SXG | ABC.PR05.1819.SXG | 12/06/2020 | $ 111,111.11 |
ABC.0002.1819I.SXG | ABC.PR06.1819.SXG | 17/07/2020 | $ 111,111.11 |
ABC.0002.1819I.SXG | ABC.PR08.1819.SXG | 15/09/2020 | $ 111,111.11 |
ABC.0004.1819E.FGH | ABC.PR03.1819.FGH | 01/07/2020 | $ 286,729.76 |
ABC.0004.1819E.FGH | ABC.PR06.1819.FGH | 09/11/2020 | $ 268,972.07 |
ABC.0004.1819E.FGH | ABC.PR04.1819.FGH | 18/09/2020 | $ 268,972.07 |
ABC.0004.1819E.FGH | ABC.PR10.1819.FGH | 10/12/2020 | $ 268,972.07 |
ABC.0014.1819E.FGH | ABC.PR03.1819.FGH | 01/07/2020 | $ 397,962.54 |
ABC.0014.1819E.FGH | ABC.PR06.1819.FGH | 09/11/2020 | $ 326,679.50 |
ABC.0014.1819E.FGH | ABC.PR04.1819.FGH | 18/09/2020 | $ 324,312.77 |
ABC.0014.1819E.FGH | ABC.PR10.1819.FGH | 10/12/2020 | $ 326,679.50 |
XYZ.0001.1819I.SXG | XYZ.PR01.1819.SXG | 05/12/2019 | $ 23,961.11 |
XYZ.0001.1819I.SXG | XYZ.PR02.1819.SXG | 28/01/2020 | $ 23,961.11 |
XYZ.0001.1819I.SXG | XYZ.PR03.1819.SXG | 25/02/2020 | $ 23,961.11 |
XYZ.0001.1819I.SXG | XYZ.PR05.1819.SXG | 11/03/2020 | $ 23,961.11 |
XYZ.0001.1819I.SXG | XYZ.PR06.1819.SXG | 13/05/2020 | $ 23,961.11 |
XYZ.0002.1920A.LIP | XYZ.PR03.1920.LIP | 09/06/2020 | $ 5,112.99 |
XYZ.0002.1920A.LIP | XYZ.PR01.1920.LIP | 13/05/2020 | $ 5,112.99 |
XYZ.0003.1920K.FGH | XYZ.PR05.1920.FGH | 10/12/2020 | $ 455,466.64 |
XYZ.0003.1920K.FGH | XYZ.PR03.1920.FGH | 04/11/2020 | $ 530,471.67 |
XYZ.0003.1920K.FGH | XYZ.PR02.1920.FGH | 23/09/2020 | $ 460,416.67 |
XYZ.0003.1920K.FGH | XYZ.PR01.1920.FGH | 21/08/2020 | $ 460,416.67 |
XYZ.0005.1920K.FGH | XYZ.PR05.1920.FGH | 10/12/2020 | $ 1,400,645.44 |
XYZ.0005.1920K.FGH | XYZ.PR03.1920.FGH | 04/11/2020 | $ 1,481,465.83 |
XYZ.0005.1920K.FGH | XYZ.PR02.1920.FGH | 23/09/2020 | $ 1,355,555.56 |
XYZ.0005.1920K.FGH | XYZ.PR01.1920.FGH | 21/08/2020 | $ 1,355,555.56 |
XYZ.0006.1920K.FGH | XYZ.PR01.1920.FGH | 21/08/2020 | $ 144,166.67 |
XYZ.0006.1920K.FGH | XYZ.PR02.1920.FGH | 23/09/2020 | $ 144,166.67 |
XYZ.0006.1920K.FGH | XYZ.PR03.1920.FGH | 04/11/2020 | $ 144,166.67 |
XYZ.0006.1920K.FGH | XYZ.PR05.1920.FGH | 10/12/2020 | $ 144,166.67 |
@APMarsh , Try a measure like
calculate(sum(Table[Estimated Final Cost]), filter(Table,Table[Lodgement date] = calculate(max(Table[Lodgement date]), allexpcept(Table,table[Reference Number]))))
Hi Amitchandak,
Thanks for the suggestions. I did try this function as well - and it doesnt get the result i need. It needs to be able to sum across time (similar to a cumulative...but only summing the latest value).
For example:
The sum on Wed night is 38.
The sum on Thurs night = 2+7+20+3+1+6+0 = 39
When i use any of the below code it works ok when i filter on a single reference number, however when I filter at the aggregated level, it doesnt work.
var test2 =
CALCULATE(SUM('Prog report data - CUBE'[Estimated Final Cost]),
FILTER('Prog report data - CUBE','Prog report data - CUBE'[PR lodgement date]=
CALCULATE(MAX('Prog report data - CUBE'[PR lodgement date]),
USERELATIONSHIP('Date'[Date],'Prog report data - CUBE'[PR lodgement date]),
FILTER(ALL('Date'[Date]),'Date'[Date]<=MAX('Date'[Date])),
FILTER(ALL('Date'[Date]),'Date'[Date]<>BLANK())
)))
var test3 =
SUMX(
SUMMARIZE('Prog report data - CUBE',
'Prog report data - CUBE'[Submission Number],"Sub NumberX",
CALCULATE(SUM('Prog report data - CUBE'[Estimated Final Cost]),
//FILTER('Prog report data - CUBE','Prog report data - CUBE'[PR lodgement date]=MAX('Prog report data - CUBE'[PR lodgement date]))
USERELATIONSHIP('Date'[Date],'Prog report data - CUBE'[PR lodgement date]),
FILTER(ALL('Date'[Date]),'Date'[Date]<=MAX('Date'[Date])),
FILTER(ALL('Date'[Date]),'Date'[Date]<>BLANK())
)
),[Sub NumberX]
)
var test4 =
CALCULATE(test3,
//FILTER('Prog report data - CUBE','Prog report data - CUBE'[PR lodgement date]=MAX('Prog report data - CUBE'[PR lodgement date]))
USERELATIONSHIP('Date'[Date],'Prog report data - CUBE'[PR lodgement date]),
FILTER(ALL('Date'[Date]),'Date'[Date]<=MAX('Date'[Date])),
FILTER(ALL('Date'[Date]),'Date'[Date]<>BLANK())
)
var test5 =
CALCULATE(
SUM('Prog report data - CUBE'[Estimated Final Cost]),
FILTER('Prog report data - CUBE','Prog report data - CUBE'[PR lodgement date]=CALCULATE(MAX('Prog report data - CUBE'[PR lodgement date]),
ALLEXCEPT('Prog report data - CUBE','Prog report data - CUBE'[Submission Number])))
)
Plotting over time doesnt work at aggregated level:
@APMarsh , Try a measure like
Measure =
VAR __id = MAX ('Table'[Reference Number] )
VAR __date = CALCULATE ( MAX('Table'[Lodgement date] ), ALLSELECTED ('Table' ), 'Table'[Reference Number] = __id )
CALCULATE ( Min ('Table'[Estimated Final Cost] ), VALUES ('Table'[Reference Number] ),'Table'[Reference Number] = __id,'Table'[Lodgement date ] = __date )
Hi @amitchandak ,
Have you had any further thoughts about this one. I still haven't managed to find a solution.
Thanks Amitchandak,
I tried the below measure but it seems to give an uexpected result.
I will keep trying and let you know when i get it.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
18 | |
15 | |
12 | |
11 | |
8 |
User | Count |
---|---|
24 | |
17 | |
11 | |
11 | |
10 |