Powerpivot-Changing Dates and Audit Scores

songgirl101

New Member
Joined
May 23, 2016
Messages
10
I am having an issue with how to get excel's powerpivot to calculate the most recent date with UPDATING and historical data.I have created a powerpivot to show suppliers audit class scores but when those suppliers are audited multiple times over the years the score changes and I need the powerpivot to display on the most recent date and score. For example, right now I have the count of # of suppliers with risk score 1,2,3,etc. But say supplier ABC is audited in 2011 with a 1 and 2012 with a 2. I need the pivot to count only the most recent score (the 2) so that the count of number of suppliers isn't counting the same supplier twice. This sounds super confusing but I can't upload the document due to this forum rules. The formula I tried so far is: =CALCULATE(max([Audit Date]),filter(DATA,DATA[Supplier Name]=EARLIER(DATA[Supplier Name]))) which calculates the latest audit date but I can't figure out how to choose the audit score on that date. The end result I need to get is I need it to calculate the max score from the latest DATE of the audit and then return that back to a pivottable. Hope that helps clarify my question.
 
Making a few assumptions here. Notably that you have a separate Calendar dimension table related to DATA table and the pivot has Supplier ID on the rows. One possible measure to use is:

Code:
Last Audit Class Score := CALCULATE( SUM(DATA[Audit Class Score]), LASTNONBLANK( Calendar[Date],  SUM( DATA[Audit Class Score] ) ) )

Also assumes that there is only one Audit Class Score per Supplier per Audit Date. Even though I use SUM if there is only one Audit Class Score on that date that value will be returned.
 
Upvote 0
Making a few assumptions here. Notably that you have a separate Calendar dimension table related to DATA table and the pivot has Supplier ID on the rows. One possible measure to use is:

Code:
Last Audit Class Score := CALCULATE( SUM(DATA[Audit Class Score]), LASTNONBLANK( Calendar[Date],  SUM( DATA[Audit Class Score] ) ) )

Also assumes that there is only one Audit Class Score per Supplier per Audit Date. Even though I use SUM if there is only one Audit Class Score on that date that value will be returned.

Thank you! It gives me an error that there it cannot find table calendar. Is there a way to fix that? My data is as follows (the max audit date is irrelevant as I don't want max I was just testing it out) :
Supplier NameAudit DateAudit ScoreMax Audit ScoreLatestAuditDate
ABC1/1/2012234/4/2014
ABC4/4/2014334/4/2014
DEF1/2/2015111/2/2015
GHI5/5/2016225/5/2016
JKL5/6/2015115/6/2015
MNO2/3/2016112/3/2016
PQR4/3/2016114/3/2016
STU7/11/2013152/3/2016
VWX8/21/2012118/21/2012
YZ9/10/2011339/10/2011
STU2/3/2016552/3/2016
TEST7/11/2013152/3/2016
TEST8/21/2012352/3/2016
TEST9/10/2011552/3/2016
TEST2/3/2016452/3/2016
TEST7/11/2013252/3/2016

<tbody>
</tbody>
The formula I have for latest audit date is: =CALCULATE(max([Audit Date]),filter(DATA,DATA[Supplier Name]=EARLIER(DATA[Supplier Name]))) I thought I could use that to match what the score is on that date but no luck and not sure thats what needs to happen.
 
Upvote 0
Code:
[COLOR=#333333]Last Audit Class Score := CALCULATE( SUM(DATA[Audit Class Score]), LASTNONBLANK( DATA['Audit Date'],  SUM( DATA[Audit Class Score] ) ) )[/COLOR]

With this measure you don't need the last two columns of your test data.
 
Last edited:
Upvote 0
Code:
[COLOR=#333333]Last Audit Class Score := CALCULATE( SUM(DATA[Audit Class Score]), LASTNONBLANK( DATA['Audit Date'],  SUM( DATA[Audit Class Score] ) ) )[/COLOR]

With this measure you don't need the last two columns of your test data.

Unfortunately that only returns the audit score that is already there, not the latest audit score. I have pasted below the data and what I need the end result to look like. The end result is the audit score and count of audit score columns. The count of audit scores counts only the most recent score. I need to find some way to automate this so excel/powerpivot calculates it instead of a manual calculation. Thanks for your help!

[TABLE="width: 593"]
<colgroup><col><col><col><col span="2"><col><col></colgroup><tbody>[TR]
[TD]Supplier Name[/TD]
[TD]Audit Date[/TD]
[TD] Audit Score[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]ABC[/TD]
[TD="align: right"]1/1/2012[/TD]
[TD="align: right"]2[/TD]
[TD][/TD]
[TD][/TD]
[TD]Audit Score[/TD]
[TD] Count of Audit Score[/TD]
[/TR]
[TR]
[TD]ABC[/TD]
[TD="align: right"]4/4/2014[/TD]
[TD="align: right"]3[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]6[/TD]
[/TR]
[TR]
[TD]DEF[/TD]
[TD="align: right"]1/2/2015[/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]GHI[/TD]
[TD="align: right"]5/5/2016[/TD]
[TD="align: right"]2[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]JKL[/TD]
[TD="align: right"]5/6/2015[/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]MNO[/TD]
[TD="align: right"]2/3/2016[/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]PQR[/TD]
[TD="align: right"]4/3/2016[/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]STU[/TD]
[TD="align: right"]7/11/2013[/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]VWX[/TD]
[TD="align: right"]8/21/2012[/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]YZ[/TD]
[TD="align: right"]9/10/2011[/TD]
[TD="align: right"]3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]STU[/TD]
[TD="align: right"]2/3/2016[/TD]
[TD="align: right"]5[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]TEST[/TD]
[TD="align: right"]7/11/2014[/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]TEST[/TD]
[TD="align: right"]8/21/2012[/TD]
[TD="align: right"]3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]TEST[/TD]
[TD="align: right"]9/10/2011[/TD]
[TD="align: right"]5[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]TEST[/TD]
[TD="align: right"]2/3/2016[/TD]
[TD="align: right"]4[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]TEST[/TD]
[TD="align: right"]7/11/2013[/TD]
[TD="align: right"]2[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Not sure I understand what you want the final pivot to look like. Per my post above I assumed just Supplier and the last audit score in pivot. Are you wanting Audit Score and Count of audit score? If so how will you know for which Supplier the score is associated? Or do you really just need to know how many suppliers under each latest Audit Score?
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top