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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors