Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Using MAX to filter for the current Fiscal week

The data set im working with tracks our internal fiscal week with "FWxx" format. I would like to set a dynamic filter for this data so that it always automatically filters for the highest number week. 

 

I tried doing this: 

Week Filter = Max(Query[Fiscal Week])

 

However, I am not able to set that as a filter. If anyone can think of a way to use this function to filter, I would appreciate it! 

  • Hi, Anonymous 

     

    You can try the following methods.

    Column:

    Fiscal Week = WEEKNUM([Date],2)

    Measure:

    Week Filter = 
    IF (
        SELECTEDVALUE ( Query[Fiscal Week] )
            = CALCULATE (
                MAX ( Query[Fiscal Week] ),
                ALLEXCEPT ( Query, Query[Fiscal Week] )
            ),
        1,
        0
    )

    In this case the view will show only the highest week. Does this meet your desired outcome?

     

    Best Regards,

    Community Support Team _Charlotte

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

2 Replies

  • Anonymous , try like

    Week Filter = MaxX(allselected(Query) ,Query[Fiscal Week])

    or


    Week Filter =
    avr _date = MaxX(allselected(Query) ,Query[Date])
    return
    maxx(filter( Query, Query[Date]=_date), Query[Fiscal Week])

  • v-zhangti's avatar
    v-zhangti
    Icon for Community Support rankCommunity Support

    Hi, Anonymous 

     

    You can try the following methods.

    Column:

    Fiscal Week = WEEKNUM([Date],2)

    Measure:

    Week Filter = 
    IF (
        SELECTEDVALUE ( Query[Fiscal Week] )
            = CALCULATE (
                MAX ( Query[Fiscal Week] ),
                ALLEXCEPT ( Query, Query[Fiscal Week] )
            ),
        1,
        0
    )

    In this case the view will show only the highest week. Does this meet your desired outcome?

     

    Best Regards,

    Community Support Team _Charlotte

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