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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
SG1080
Frequent Visitor

Three Dates Filter Problem

Hi there ,

following challenge. I have a KPI that I want to filter on three different dates. On the one hand, I want the order to be no older than 3 months and that the shipping must not be more than 1 month old. I have three date tables Date;Date_Order;Date_Shipping. All tables have a month index column. All date tables are linked to the fact table. Does anyone have an idea how I can solve this using a measure?
Shipping.PNG
1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi @SG1080 ,

Test like the below :

1.create a slicer table :

dataslicer = CALENDAR("2021,1,1","2022,12,31")

2.then create measure:( the order to be no older than 3 months and that the shipping must not be more than 1 month old.)

test =
IF (
    DATEDIFF (
        MAX ( 'Table'[Order date] ),
        SELECTEDVALUE ( dataslicer[Date] ),
        DAY
    ) >= 0
        && DATEDIFF (
            MAX ( 'Table'[Order date] ),
            SELECTEDVALUE ( dataslicer[Date] ),
            DAY
        ) <= 90
        && DATEDIFF (
            MAX ( 'Table'[Shipping Date] ),
            SELECTEDVALUE ( dataslicer[Date] ),
            DAY
        ) >= 0
        && DATEDIFF (
            MAX ( 'Table'[Shipping Date] ),
            SELECTEDVALUE ( dataslicer[Date] ),
            DAY
        ) <= 30,
    1,
    0
)

Apply filter  and output,you could select the date you want to apply:

vluwangmsft_1-1647248452501.png

vluwangmsft_2-1647248464015.png

Did I answer your question? Mark my post as a solution!


Best Regards

Lucien

View solution in original post

2 REPLIES 2
v-luwang-msft
Community Support
Community Support

Hi @SG1080 ,

Test like the below :

1.create a slicer table :

dataslicer = CALENDAR("2021,1,1","2022,12,31")

2.then create measure:( the order to be no older than 3 months and that the shipping must not be more than 1 month old.)

test =
IF (
    DATEDIFF (
        MAX ( 'Table'[Order date] ),
        SELECTEDVALUE ( dataslicer[Date] ),
        DAY
    ) >= 0
        && DATEDIFF (
            MAX ( 'Table'[Order date] ),
            SELECTEDVALUE ( dataslicer[Date] ),
            DAY
        ) <= 90
        && DATEDIFF (
            MAX ( 'Table'[Shipping Date] ),
            SELECTEDVALUE ( dataslicer[Date] ),
            DAY
        ) >= 0
        && DATEDIFF (
            MAX ( 'Table'[Shipping Date] ),
            SELECTEDVALUE ( dataslicer[Date] ),
            DAY
        ) <= 30,
    1,
    0
)

Apply filter  and output,you could select the date you want to apply:

vluwangmsft_1-1647248452501.png

vluwangmsft_2-1647248464015.png

Did I answer your question? Mark my post as a solution!


Best Regards

Lucien

amitchandak
Super User
Super User

@SG1080 , For shipping and order date you can have filters like

 

Calculate(sum(Table[Count]), filter(Table, Table[Order Date] >= eomonth(today(),-3)  && Table[Shipping Date] >= eomonth(today(),-1) ) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.