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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Nasus_
Regular Visitor

Measure to DateDiff Date against SELECTEDVALUE Date

Looking for a bit of help here. 

 

Currently trying to create two measures for a table, which compare a DocumentDate Column with a Selected Date from a Slicer. 

 

Following Logic I'm Trying to Achieve is, 

 

If the DateDifference between DocumentDate and the SelectedValue Date is < 30 Days then Sum(Amount) , else Blank. 

 

Likewise for the second measure but if the datedifference is >= 30 and <= 60 Days

 

Looking for help as the measure wont simply let me put in the DocumentDate field into the datediff calculation without a function e.g. MAX/MIN/SELECTEDVALUE

 

Any help greatly appreciated

Nasus__1-1693834987631.png

 

3 REPLIES 3
eliasayyy
Super User
Super User

hello graeter than 30 what ? days , momntsh year weeks? please specify


Days , aplologies 

Ok you will need to use switch with max functuons

 

SWITCH(

TRUE(),

ABS(DATEDIFF(MAX('Table'[date]),MAX('dateTable[Date]),DAY)) <30 , SUM([Amount]),

ABS(DATEDIFF(MAX('Table'[date]),MAX('dateTable[Date]),DAY)) >=30 && ABS(DATEDIFF(MAX('Table'[date]),MAX('dateTable[Date]),DAY)) <= 60 ,sum([amount]),

blank()

)

 

 

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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