Forum Discussion

Hugo999's avatar
Hugo999
Frequent Visitor
1 year ago
Solved

special slicer?

Dears   I have a simple table with a Month column (stored as an integer) and a Value column. For example, 2401 represents January 2024, 2402 represents February 2024, and so on. The table contains ...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Hugo999 , hello Idrissshatila, thank you for your prompt reply!

    For your situation, please create an index column in table first, then create the measure as shown below:

     

    FilterMeasure = 
    VAR SelectedMonths = SELECTEDVALUE(PeriodSelection[NumMonths])  
    VAR MaxMonth =CALCULATE(MAX('Table'[Index]),ALLSELECTED('Table')) 
    VAR MinMonth = MaxMonth - SelectedMonths + 1  
    RETURN 
    IF(MAX('Table'[Index]) >= MinMonth && MAX('Table'[Index]) <= MaxMonth, 1, 0)
    
    

    Then filter the bar chart visual with measure=1:

    Result for your reference:

    Best regards,

    Joyce

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

    ā€ƒā€ƒ