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! Request now

Reply
macwhe
Helper I
Helper I

Compare dates based on a selected date

Hi All,

I need to add a measure to calculate Total amount based on a selected Date .  However I need to compare the selected date against Accounting Date and Freeze Date . The filter in the measure shoudl be Accountdate <= Selected Date and Freeze Date > Selected Date 

 Here is the table :

Before filterBefore filter



Lets suppose the selected date is 31 March 2021.  so the expected result should be

Expected resultsExpected results

 

Thanks a lot

1 ACCEPTED SOLUTION

You were right . I have deleted the relationship and now it works fine

Thanks you much for your help

 

View solution in original post

4 REPLIES 4
macwhe
Helper I
Helper I

Hello 

 

Unfortunately it didnt work .  It shows blank If I add this measure.  FYI, my dimension date  has a relationship with Freeze date. Any ideas?

 

Thanks a lot again

Hey @macwhe ,

 

can post a screenshot of the data model, relationships and of the report page.

Otherwise if the data is not sensitive can you upload it or send it directly to me?

 

The example works for me, but dependent of your data model it might need a different approach for your model.

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

You were right . I have deleted the relationship and now it works fine

Thanks you much for your help

 

selimovd
Super User
Super User

Hey @macwhe ,

 

check if the following measure works for you:

Sum Amount =
VAR vSelectedDate =
    SELECTEDVALUE( DateTable[Date] )
RETURN
    CALCULATE(
        SUM( myTable[Amount] ),
        myTable[AccountingDate] <= vSelectedDate && myTable[Freeze Date] > vSelectedDate
    )

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

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