Forum Discussion

ahhk2000's avatar
ahhk2000
Copper Contributor
Feb 17, 2021
Solved

Power Pivot values based on criteria

Hi Forum, advice appreciated on this situation based on the attached sheet. I made this sample on a Mac (no Power Pivot in Excel) , the actual situation is at work with a large data model involved.  ...
  • SergeiBaklan's avatar
    Feb 17, 2021

    ahhk2000 

    If without data model you may add two helper columns

    as

    =COUNTIFS([Company],[@Company])
    
    and
    
    =MIN(TODAY()-MAXIFS([Service Date],[Service Type],"High Touch",[Company],[@Company]),40000)

    With that you may add slicers on these fields and move somewhere away, e.g. into separate hided sheet. 

    If you shift on Windows or one day Power Pivot appears on Mac, you may add two measures and use them in PivotTable (green one)

    Count of Clients:=VAR cnt=COUNTROWS(Table1)
    VAR DaysSince=CALCULATE(
           TODAY()-MAX(Table1[Service Date]),
           FILTER(Table1, Table1[Service Type]="High Touch")
    )
    RETURN
        IF( OR(DaysSince=TODAY(), cnt<2), BLANK(), cnt)
    
    and
    
    Days since High Touch:=VAR cnt=COUNTROWS(Table1)
    VAR DaysSince=CALCULATE(
           TODAY()-MAX(Table1[Service Date]),
           FILTER(Table1, Table1[Service Type]="High Touch")
    )
    RETURN
        IF( OR(DaysSince=TODAY(), cnt<2), BLANK(), DaysSince)