Forum Discussion
Pivot Table Slicer not displaying all dates
- Dec 03, 2020
I added calculated column
with formula
=IF( ISBLANK( CALCULATE( MAX(Table1[Value]), FILTER(ALLEXCEPT(Table1,Table1[ID]),Table1[Date]<EARLIER(Table1[Date]))) ), BLANK(), Table1[Value]-CALCULATE( MAX(Table1[Value]), FILTER(ALLEXCEPT(Table1,Table1[ID]),Table1[Date]<EARLIER(Table1[Date])) ) )
and add it into PivotTable
Please check if you may open the model in attached file.
SergeiBaklan Sounds like a plan! How do I go about creating the measure?
Im using excel 2013, so i am using calculated fields.
What will be the correct formula?
Thanks
If I understood the logic correctly we'd like to pivot like this
If create the measure
Value to Prev:=
VAR currentDate=MAX(Table1[Date])
VAR minDate=CALCULATE(
MIN(Table1[Date]),
ALL(Table1[Date])
)
VAR prevDate=CALCULATE(
MAX(Table1[Date]),
ALL(Table1[Date]),
KEEPFILTERS(Table1[Date] < currentDate)
)
VAR prevValue=CALCULATE(
MAX(Table1[Value]),
Table1[Date]=prevDate
)
VAR currentValue=MAX(Table1[Value])
VAR Result = IF(
currentDate=minDate,
BLANK(),
currentValue - prevValue
)
RETURN Result
filtered values will be like
- nardayDec 02, 2020Copper Contributor
SergeiBaklan Hello Thank you for your reply,
Actually, your example above for the 2020-01-25 slicer should actually be 8 not 3, because that's the difference to date 2020-01-15. The middle table equation you did is three which is the difference. I don't think that's correct.
Also, 2020-01-25 should be 1006.
Somehow, it needs to memorise the figure and display after slicer has been implemented.
Also, your sheet doesn't work. I am using excel 2013 on professional plus...you able to convert or can you save the formula on my files?
I have added my workbook here for you to have a look at please?
- SergeiBaklanDec 02, 2020Diamond Contributor
Sorry, but I did as in your model. If the take source data for ID=100, they are
and in your PivotTable it is shown as
2230-2196 = 34
2196-2191 = 5
Based on your comments it shall show 2230 for Nov 30, and after that difference. If you'd like to change current logic as in your file, please explain which on it shall be.
2013 and 365 files are in same format, which error do you have opening the file?
- nardayDec 03, 2020Copper Contributor
So sorry Sergei,
I was wrong about the calculation. Indeed, your pivot table displays the correct number. Apologies again.
Just to reiterate, for ID 101. The difference between 15/01/2020 - 25-01-2020 is 3 of which your centre table and pivot slicer presents which is correct and what I'm looking for.
Ok, now that's clear. The images attached are the errors when i try to open from the ribbon powerpivot > manage the second image is when i try to click the slicer.