Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
RuyiLuo
Regular Visitor

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 

微信截图_20230525160921.png

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

2 REPLIES 2
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.

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,

微信截图_20230531094629.png

the year filter is date hierarchy,

微信截图_20230531094909.png

The other column can filter ,except date column

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.