SOLVED

Pivot Table Slicer not displaying all dates

%3CLINGO-SUB%20id%3D%22lingo-sub-1944050%22%20slang%3D%22en-US%22%3EPivot%20Table%20Slicer%20not%20displaying%20all%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1944050%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20guys%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20using%20power%20query.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ethe%20original%20data%20is%20aggregated%2C%20so%20to%20find%20values%20on%20a%20certain%20day%2C%20i%20have%20just%20asked%20the%20pivot%20table%20to%20show%20difference%20from%20previous%20item.%20Read%20below%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20created%20a%20pivot%20table%20(image%201)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ethat%20pivot%20table%20displays%20email%20sends%20per%20campaign%20id%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ethe%20values%20in%20the%20pivot%20table%20are%20based%20as%20'difference%20from'%20date%20and%20'base%20item'%20previous%20(image%202)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20i%20insert%20a%20slicer%2C%20the%20dates%20disappear%20because%20its%20looking%20at%20the%20previous%20item%2C%20which%20has%20been%20removed%20by%20the%20slicer%20(image%203)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHow%20do%20i%20go%20about%20solving%20this%20issue%20please%20%3CLI-EMOJI%20id%3D%22lia_slightly-smiling-face%22%20title%3D%22%3Aslightly_smiling_face%3A%22%3E%3C%2FLI-EMOJI%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1944050%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1945811%22%20slang%3D%22en-US%22%3ERe%3A%20Pivot%20Table%20Slicer%20not%20displaying%20all%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1945811%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F864521%22%20target%3D%22_blank%22%3E%40narday%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI'd%20suggest%20creating%20the%20PivotTable%20add%20data%20to%20data%20model%20and%20using%20Power%20Pivot%20DAX%20create%20measures%20which%20will%20calculate%20the%20difference%20of%20values%20with%20ones%20for%20basis%20date%20of%20each%20ID.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1946108%22%20slang%3D%22en-US%22%3ERe%3A%20Pivot%20Table%20Slicer%20not%20displaying%20all%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1946108%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3BSounds%20like%20a%20plan!%20How%20do%20I%20go%20about%20creating%20the%20measure%3F%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIm%20using%20excel%202013%2C%20so%20i%20am%20using%20calculated%20fields.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20will%20be%20the%20correct%20formula%3F%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1949022%22%20slang%3D%22en-US%22%3ERe%3A%20Pivot%20Table%20Slicer%20not%20displaying%20all%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1949022%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F864521%22%20target%3D%22_blank%22%3E%40narday%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20I%20understood%20the%20logic%20correctly%20we'd%20like%20to%20pivot%20like%20this%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20567px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F237343i444B467486AF777B%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EIf%20create%20the%20measure%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3EValue%20to%20Prev%3A%3D%0AVAR%20currentDate%3DMAX(Table1%5BDate%5D)%0AVAR%20minDate%3DCALCULATE(%0A%20%20%20%20MIN(Table1%5BDate%5D)%2C%0A%20%20%20%20ALL(Table1%5BDate%5D)%0A)%0AVAR%20prevDate%3DCALCULATE(%0A%20%20%20MAX(Table1%5BDate%5D)%2C%0A%20%20%20ALL(Table1%5BDate%5D)%2C%0A%20%20%20KEEPFILTERS(Table1%5BDate%5D%20%26lt%3B%20currentDate)%0A)%0AVAR%20prevValue%3DCALCULATE(%0A%20%20%20MAX(Table1%5BValue%5D)%2C%0A%20%20%20Table1%5BDate%5D%3DprevDate%0A)%0AVAR%20currentValue%3DMAX(Table1%5BValue%5D)%0AVAR%20Result%20%3D%20IF(%0A%20%20%20%20%20%20%20currentDate%3DminDate%2C%0A%20%20%20%20%20%20%20BLANK()%2C%0A%20%20%20%20%20%20%20currentValue%20-%20prevValue%0A)%0ARETURN%20Result%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3Efiltered%20values%20will%20be%20like%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20552px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F237344iEBE30339EF6F7538%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1949107%22%20slang%3D%22en-US%22%3ERe%3A%20Pivot%20Table%20Slicer%20not%20displaying%20all%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1949107%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3BHello%26nbsp%3BThank%20you%20for%20your%20reply%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EActually%2C%20your%20example%20above%20for%20the%202020-01-25%20slicer%20should%20actually%20be%208%20not%203%2C%20because%20that's%20the%20difference%20to%20date%202020-01-15.%20The%20middle%20table%20equation%20you%20did%20is%20three%20which%20is%20the%20difference.%20I%20don't%20think%20that's%20correct.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAlso%2C%202020-01-25%20should%20be%201006.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESomehow%2C%20it%20needs%20to%20memorise%20the%20figure%20and%20display%20after%20slicer%20has%20been%20implemented.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAlso%2C%20your%20sheet%20doesn't%20work.%20I%20am%20using%20excel%202013%20on%20professional%20plus...you%20able%20to%20convert%20or%20can%20you%20save%20the%20formula%20on%20my%20files%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20added%20my%20workbook%20here%20for%20you%20to%20have%20a%20look%20at%20please%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1950385%22%20slang%3D%22en-US%22%3ERe%3A%20Pivot%20Table%20Slicer%20not%20displaying%20all%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1950385%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F864521%22%20target%3D%22_blank%22%3E%40narday%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESorry%2C%20but%20I%20did%20as%20in%20your%20model.%20If%20the%20take%20source%20data%20for%20ID%3D100%2C%20they%20are%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20437px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F237400i7848EBB72299DE48%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3Eand%20in%20your%20PivotTable%20it%20is%20shown%20as%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20167px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F237401iF538B8D3E47FD8CB%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E2230-2196%20%3D%2034%3C%2FP%3E%0A%3CP%3E2196-2191%20%3D%205%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBased%20on%20your%20comments%20it%20shall%20show%202230%20for%20Nov%2030%2C%20and%20after%20that%20difference.%20If%20you'd%20like%20to%20change%20current%20logic%20as%20in%20your%20file%2C%20please%20explain%20which%20on%20it%20shall%20be.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E2013%20and%20365%20files%20are%20in%20same%20format%2C%20which%20error%20do%20you%20have%20opening%20the%20file%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1951620%22%20slang%3D%22en-US%22%3ERe%3A%20Pivot%20Table%20Slicer%20not%20displaying%20all%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1951620%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20sorry%20Sergei%2C%3C%2FP%3E%3CP%3EI%20was%20wrong%20about%20the%20calculation.%20Indeed%2C%20your%20pivot%20table%20displays%20the%20correct%20number.%20Apologies%20again.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJust%20to%20reiterate%2C%20for%20ID%20101.%20The%20difference%20between%2015%2F01%2F2020%20-%2025-01-2020%20is%203%20of%20which%20your%20centre%20table%20and%20pivot%20slicer%20presents%20which%20is%20correct%20and%20what%20I'm%20looking%20for.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOk%2C%20now%20that's%20clear.%20The%20images%20attached%20are%20the%20errors%20when%20i%20try%20to%20open%20from%20the%20ribbon%20powerpivot%20%26gt%3B%20manage%20the%20second%20image%20is%20when%20i%20try%20to%20click%20the%20slicer.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1951997%22%20slang%3D%22en-US%22%3ERe%3A%20Pivot%20Table%20Slicer%20not%20displaying%20all%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1951997%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F864521%22%20target%3D%22_blank%22%3E%40narday%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20see%2C%20thank%20you.%20It%20looks%20like%20Power%20Pivot%20add-in%20for%202013%20is%20very%20outdated%2C%20even%20if%20data%20models%20are%20compatible%2C%20DAX%20operators%20-%20not.%20There%20is%20no%20way%20to%20convert%20DAX%20syntax%20back%2C%20and%20I%20don't%20remember%20how%20to%20re-write%20DAX%20formula%20in%20compatible%20with%202013%20way.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWill%20try%20to%20play%20with%20it%2C%20but%20no%20promises.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hi guys

 

I am using power query.

 

the original data is aggregated, so to find values on a certain day, i have just asked the pivot table to show difference from previous item. Read below

 

I have created a pivot table (image 1)

 

that pivot table displays email sends per campaign id

 

the values in the pivot table are based as 'difference from' date and 'base item' previous (image 2)

 

When i insert a slicer, the dates disappear because its looking at the previous item, which has been removed by the slicer (image 3)

 

How do i go about solving this issue please

14 Replies

@narday 

I'd suggest creating the PivotTable add data to data model and using Power Pivot DAX create measures which will calculate the difference of values with ones for basis date of each ID.

@Sergei Baklan 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

@narday 

If I understood the logic correctly we'd like to pivot like this

image.png

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

image.png

@Sergei Baklan 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?

@narday 

Sorry, but I did as in your model. If the take source data for ID=100, they are

image.png

and in your PivotTable it is shown as

image.png

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?

@Sergei Baklan 

 

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.

@narday 

I see, thank you. It looks like Power Pivot add-in for 2013 is very outdated, even if data models are compatible, DAX operators - not. There is no way to convert DAX syntax back, and I don't remember how to re-write DAX formula in compatible with 2013 way.

 

Will try to play with it, but no promises.

No, thank you, Sergei. I've been stuck on this for many months and you're the only one who helped.

Do you know how i upgrade to 2013 power pivot?

Ive added you via linked in...

@narday 

Based on this link Download Microsoft PowerPivot for Excel 2010 and PowerPivot in Excel 2013 Samples from Official Micr... Power Pivot for 2013 was last time updated  almost 8 years ago. 

image.png

You may try to download it from here. Not sure it will help, but who knows. At least you will have the latest Power Pivot for 2013.

hmm, i have 2013, but i need 2016? Youre using 2016?

How difficult would it be to convert the dax?
best response confirmed by narday (Occasional Contributor)
Solution

@narday 

I added calculated column

image.png

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

image.png

Please check if you may open the model in attached file.

@Sergei Baklan Hey, sorry for delay in responding, been working on this.

 

Ok, the work book works AND i have attempted to insert the formula. image 1 will show this.

 

Image 2 shows a query error? Im not sure what this is?

 

Could you help? Im nearly there Sergei i believe, i really appreciate your help.

 

thanks

@Sergei Baklan Sergei! It worked! haha! I just rewrote it using the 'tab' on keyboard.

 

It works! I cant believe it!

 

GENIUS!

 

Please accept my invite on linkedin

@narday 

Great to know, thank you for sharing. I'm quite seldom on LinkedIn, will do when be next time.