Forum Discussion

RuyiLuo's avatar
RuyiLuo
Regular Visitor
3 years ago

How to make date columns filterable

My data sheets span from 2016 to 2022,I filter the data behind by the previous time period, such as 2016 to 2018,The table name is "ALLORDER",Measures below

 

_Result = 
    var tb1 = FILTER(VALUES(ALLORDER[magic]),[order_count_2016]+[order_count_2017]+[order_count_2018]<=20)
    var tb2 = FILTER(tb1,[avg_profit_2016]>=0.4 || [avg_profit_2017]>=0.4 || [avg_profit_2018]>=0.4)
    var tb3 = FILTER(ALLORDER,ALLORDER[magic] in tb2 && ALLORDER[date].[year]>2018)
    return
    calculate([_PROFIT],tb3)

[order_count_2016] = COUNTX(FILTER(ALLORDER,ALLORDER[date].[year]=2016),ALLORDER[profit])

[avg_profit_2016] = 
    var tmptable = FILTER(ALLORDER,ALLORDER[date].[year]=2016)
    return
    SUMX(tmptable,ALLORDER[profit])/COUNTX(tmptable,ALLORDER[profit])

 

The calculation turned out to be correct!

But put it on the visual table,use date column filter,it doesn't work.The other column works,like this 

How can I fix this and be able to filter by date

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi RuyiLuo 

    Is your date column filtered to exclude 2016? As you can see from your measures that your measures are fixed-years, make sure that you include these fixed years in your year filter. and can you provide some sample data or pictures so that we can better advise you?

     

    Best Regards!

    Yolo Zhu

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

    • RuyiLuo's avatar
      RuyiLuo
      Regular Visitor

      I‘m sorry,I don't understand "make sure that you include these fixed years in your year filter" mean,The table is a trader order,like this,

      the year filter is date hierarchy,

      The other column can filter ,except date column