Forum Discussion

ningles's avatar
ningles
Regular Visitor
2 years ago
Solved

Need help with Slicer

Hello, I have a dataset with summarized call data by Date, Agent, and FCR Type. The FCR Types are as follows: FCR2 = Call that did not lead to another call within 2 days. FCR10 = Ca...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi ningles ,

    According to your description, here are my steps you can follow as a solution.

    (1)My test data is the same as yours.

    (2) We can create a table.

    Slicer = VALUES('Table'[FCRType]) 

    (3) We can create a measure. 

    Flag = 
    var _a=CALCULATE(MAX('Table'[Date]),FILTER(ALLSELECTED('Table'),'Table'[FCRType]="FCR2"))-2
    var _b=CALCULATE(MAX('Table'[Date]),FILTER(ALLSELECTED('Table'),'Table'[FCRType]="FCR10"))-10
    var _c=CALCULATE(MAX('Table'[Date]),FILTER(ALLSELECTED('Table'),'Table'[FCRType]="FCR30"))-30
    return SWITCH(TRUE(),
    ISFILTERED(Slicer[FCRType])=FALSE(),1,
    SELECTEDVALUE('Slicer'[FCRType])="FCR2" && MAX('Table'[FCRType])="FCR2" && MAX('Table'[Date])<=_a,1,
    SELECTEDVALUE('Slicer'[FCRType])="FCR10" && MAX('Table'[FCRType])="FCR10" && MAX('Table'[Date])<=_b,1,
    SELECTEDVALUE('Slicer'[FCRType])="FCR30" && MAX('Table'[FCRType])="FCR30" && MAX('Table'[Date])<=_c,1,0)

    (4) Place the fields of the new table [Slicer] on the slicer and [Flag=1] on the table visual object.

    Best Regards,

    Neeko Tang

    If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly.