Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Dynamic flag with a date slicer

Hi community, Is it possible to create a dynamic column or something with the same functionality? I need this to flag the rows in a table dinamically depending on a date slicer.    So I have a t...
  • Mariusz's avatar
    Mariusz
    6 years ago

    Hi Anonymous 

     

    Try something like this.

     

    filter = 
    VAR __maxSelectedDate = 
        GROUPBY(
            CALCULATETABLE(
                FILTER( 
                    'Table',
                    'Table'[Date] <= MAX( 'Dates'[Date] ) 
                ),
                ALLEXCEPT( 'Table', 'Table'[Store] ) ),
            'Table'[Store],
            "@maxDate", MAXX( CURRENTGROUP(), 'Table'[Date] )
        ) 
    RETURN 
        CALCULATE( 
            COUNTROWS( 'Table' ),
            KEEPFILTERS( 
                TREATAS( __maxSelectedDate, 'Table'[Store], 'Table'[Date] )
            )
        )

     

    Sum of filter = 
    CALCULATE( 
        SUM( 'Table'[Value] ), 
        FILTER( 'Table' , [filter] ) 
    )
    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.