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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Dhacd
Resolver III
Resolver III

Using date Slicer to find what state the product is in the selected date.

Good Day Team,

 

Let's get familiarized with the dataset.

Here is the product status table. (Please read the date header as LoggedDate) 

Dhacd_0-1655862803732.png

Along with this we also have a master calendar table which is just a calendar table date starting from June 1 to June 30th

The problem,
We are bringing all the columns of the product status table to a table to the front end and the date column(from the master calendar) as a slicer to the front end.
Now when we select a date in the slicer it should show whether any products are in the system at any status.
For eg:
Suppose we select the 4th of June.

The table should only show the below records(Since these 2 products are the only records before the 4th-June and have a record after the 4th-June).

 

IndexProductLoggedDateState
1Apple03-JunDispatched
4Orange03-JunOrdered

 

The sample data is attached below.

IndexProductLoggedDateState
0Apple01-JunOrdered
1Apple03-JunDispatched
2Apple05-JunOn Transit
3Apple06-JunDelivered
4Orange03-JunOrdered
5Orange05-JunDispatched
6Orange07-JunOn Transit
7Orange08-JunDelivered
8Grapes05-JunOrdered
9Grapes07-JunDispatched
10Grapes09-JunOn Transit
11Grapes10-JunDelivered
12Mango07-JunOrdered
13Mango09-JunDispatched
14Mango11-JunOn Transit
15Mango12-JunDelivered

 

Break a leg, guys,
Thanks in advance.
and regards,
Atma.

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

I suggest having a disconnected calendar table like below.

 

Untitled.png

 

LoggedDate measure: = 
VAR _lastlogdate =
    CALCULATE (
        LASTNONBLANK ( Data[LoggedDate], MAX ( Data[LoggedDate] ) ),
        FILTER (
            ALL ( Data ),
            Data[Product] = MAX ( Data[Product] )
                && Data[LoggedDate] <= MAX ( 'Calendar'[Date] )
        )
    )
RETURN
    IF (
        HASONEVALUE ( Data[Index] ),
        CALCULATE (
            MAX ( Data[LoggedDate] ),
            KEEPFILTERS ( Data[LoggedDate] = _lastlogdate )
        )
    )

 

State measure: = 
VAR _lastlogdate =
    CALCULATE (
        LASTNONBLANK ( Data[LoggedDate], MAX ( Data[LoggedDate] ) ),
        FILTER (
            ALL ( Data ),
            Data[Product] = MAX ( Data[Product] )
                && Data[LoggedDate] <= MAX ( 'Calendar'[Date] )
        )
    )
RETURN
    IF (
        HASONEVALUE ( Data[Index] ),
        CALCULATE (
            MAX ( Data[State] ),
            KEEPFILTERS ( Data[LoggedDate] = _lastlogdate )
    )
)

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

1 REPLY 1
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

I suggest having a disconnected calendar table like below.

 

Untitled.png

 

LoggedDate measure: = 
VAR _lastlogdate =
    CALCULATE (
        LASTNONBLANK ( Data[LoggedDate], MAX ( Data[LoggedDate] ) ),
        FILTER (
            ALL ( Data ),
            Data[Product] = MAX ( Data[Product] )
                && Data[LoggedDate] <= MAX ( 'Calendar'[Date] )
        )
    )
RETURN
    IF (
        HASONEVALUE ( Data[Index] ),
        CALCULATE (
            MAX ( Data[LoggedDate] ),
            KEEPFILTERS ( Data[LoggedDate] = _lastlogdate )
        )
    )

 

State measure: = 
VAR _lastlogdate =
    CALCULATE (
        LASTNONBLANK ( Data[LoggedDate], MAX ( Data[LoggedDate] ) ),
        FILTER (
            ALL ( Data ),
            Data[Product] = MAX ( Data[Product] )
                && Data[LoggedDate] <= MAX ( 'Calendar'[Date] )
        )
    )
RETURN
    IF (
        HASONEVALUE ( Data[Index] ),
        CALCULATE (
            MAX ( Data[State] ),
            KEEPFILTERS ( Data[LoggedDate] = _lastlogdate )
    )
)

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Solution Authors