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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
LinaP_
Frequent Visitor

Slicer with an OR argument

Hi all, 

In a report I have visualized "Planned delivery dates" and "Actual delivery dates" in a table with the order number (uniqe).

I have a mock version of the table here:

Order numberPlanned date (YYMMDD)Actual date (YYMMDD)Difference in days 
A12022-01-012022-02-0130
B22022-02-012022-01-15-15
C32022-03-012022-04-1545
D42022-04-012022-01-01-90
E52022-05-012021-05-01-365

 

I have added a slicer with relative date (ex. last 6 months) and have played around with Planned dates and Actual dates.

The problem is I always miss some data as the dates can differ quite significantly in time (+100 days in some cases). 

 

In my head the solution is quite simple, a slicer with Planned date OR Actual date occurring in the last X months. Anyone know if this is possible?  

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @LinaP_ ,

I created a sample pbix file(see the attachment), please check if that is what you want.

1. Create a date dimension table and apply it to the slicer

Note: Please DO NOT create any relationship with the fact table

vyiruanmsft_1-1684897599708.png

2. Create a measure as below

Flag = 
VAR _selpdate =
    SELECTEDVALUE ( 'Table'[Planned date (YYMMDD)] )
VAR _seladate =
    SELECTEDVALUE ( 'Table'[Actual date (YYMMDD)] )
RETURN
    IF (
        (
            _seladate >= MIN ( 'Calendar'[Date] )
                && _seladate <= MAX ( 'Calendar'[Date] )
        )
            || (
                _seladate >= MIN ( 'Calendar'[Date] )
                    && _seladate <= MAX ( 'Calendar'[Date] )
            ),
        1,
        0
    )

3. Apply a visual-level filter on the visual with the condition(Flag is 1)

vyiruanmsft_0-1684897487255.png

Best Regards

View solution in original post

3 REPLIES 3
LinaP_
Frequent Visitor

Hi @Anonymous 

Thanks for the help! It captures all orders now that has an end date, which is more than I could solve! 😄

 

One issue still remains, which I did not include in my example, is that some of the "Actual" dates haven't happened yet:

Order numberPlanned (YYMMDD)Actual (YYMMDD)Difference in days
A12023-01-012023-01-010
B12023-01-012023-02-0130
C12023-05-012023-04-15-15
D12023-05-01 25

 

Do you have any idea on how to include that?

 

Warm Regards

Anonymous
Not applicable

Hi @LinaP_ ,

I created a sample pbix file(see the attachment), please check if that is what you want.

1. Create a date dimension table and apply it to the slicer

Note: Please DO NOT create any relationship with the fact table

vyiruanmsft_1-1684897599708.png

2. Create a measure as below

Flag = 
VAR _selpdate =
    SELECTEDVALUE ( 'Table'[Planned date (YYMMDD)] )
VAR _seladate =
    SELECTEDVALUE ( 'Table'[Actual date (YYMMDD)] )
RETURN
    IF (
        (
            _seladate >= MIN ( 'Calendar'[Date] )
                && _seladate <= MAX ( 'Calendar'[Date] )
        )
            || (
                _seladate >= MIN ( 'Calendar'[Date] )
                    && _seladate <= MAX ( 'Calendar'[Date] )
            ),
        1,
        0
    )

3. Apply a visual-level filter on the visual with the condition(Flag is 1)

vyiruanmsft_0-1684897487255.png

Best Regards

Hi, 

Really appreciate the help! 

Needed to do a modification to work with blank dates as following: but now it works like a charm. 

 

Flag = 
VAR _selpdate =
    SELECTEDVALUE ( 'Table'[Planned date] )
VAR _seladate =
    IF ( ISBLANK ( SELECTEDVALUE ( 'Table'[Actual date] ) ), TODAY(), SELECTEDVALUE ( ''Table'[Actual date] ) )
RETURN
    IF (
        (
            _selpdate <= TODAY() &&
            (
                (
                    _selpdate >= MIN ( 'Calendar_for_measurment'[Date] )
                    && _selpdate <= MAX ( 'Calendar_for_measurment'[Date] )
                )
                ||
                (
                    _seladate >= MIN ( 'Calendar_for_measurment'[Date] )
                    && _seladate <= MAX ( 'Calendar_for_measurment'[Date] )
                )
            )
        ),
        1,
        0
    )

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.