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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
ragnezza
Frequent Visitor

Day over Day comparison based on selection from date slicer

Hello community, I'm looking for support in a Day over Day comparison based on selections from date slicers.

I have a table with Date and ID, similar to this:

DateID
Jan 3ABC001
Jan 3ABC002
Jan 3ABC003

Jan 2

ABC001
Jan 2ABC002
Jan 1ABC001
Jan 1ABC002

 

Then I have two Date slicers:

  1. Date slicer 1 -> to simply filter records based on the selected Date;
  2. Date slicer 2 -> to create a flag (Yes/No) if the records shown at step 1. are also present in the selected day

In other words, if Date slicer 1 = Jan 3 and Date slicer 2 = Jan 2, the table should show the following:

DateIDFlag
Jan 3ABC001Yes
Jan 3ABC002Yes
Jan 3ABC003No

 

I used the following Calculated Column to get the Flag, but as you can see it's working only with hard coded condition (Date = Date-1), rather than having the Date = SELECTEDVALUE from Date slicer 2:

Flag =
IFCALCULATE (MAX (Table[ID] ), 
ALLEXCEPTTableTable[ID] ), 
Table[Date] = EARLIER(Table[Date])-1) = BLANK(), 
"Yes""No" )
 
I struggle to make it work with the SELECTEDVALUE in this formula, so I'm not sure if I have to use another approach (measure, different function,...)?
 
Any hint/recommendation is much appreciated, thanks!
Davide
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @ragnezza 

 

You can try the following measure:

 

Flag = 
VAR SelectedDate1 =
    SELECTEDVALUE ( 'Slicer1'[Date] )
VAR SelectedDate2 =
    SELECTEDVALUE ( 'Slicer2'[Date] )
RETURN
    IF (
        MAX ( [Date] ) = SELECTEDVALUE ( Slicer1[Date] ),
        IF (
            CALCULATE (
                COUNTROWS ( 'Table' ),
                'Table'[ID] = MAX ( [ID] ),
                'Table'[Date] = SelectedDate2
            ) > 0,
            "Yes",
            "No"
        ),
        BLANK ()
    )

 

 

Output:

vxuxinyimsft_1-1717056309644.png

 

Best Regards,
Yulia Xu

 

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

View solution in original post

2 REPLIES 2
ragnezza
Frequent Visitor

Thanks a lot @Anonymous this worked!

Anonymous
Not applicable

Hi @ragnezza 

 

You can try the following measure:

 

Flag = 
VAR SelectedDate1 =
    SELECTEDVALUE ( 'Slicer1'[Date] )
VAR SelectedDate2 =
    SELECTEDVALUE ( 'Slicer2'[Date] )
RETURN
    IF (
        MAX ( [Date] ) = SELECTEDVALUE ( Slicer1[Date] ),
        IF (
            CALCULATE (
                COUNTROWS ( 'Table' ),
                'Table'[ID] = MAX ( [ID] ),
                'Table'[Date] = SelectedDate2
            ) > 0,
            "Yes",
            "No"
        ),
        BLANK ()
    )

 

 

Output:

vxuxinyimsft_1-1717056309644.png

 

Best Regards,
Yulia Xu

 

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

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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