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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

is it possible to reference a measure to calculate DATEDIFF?

Hi all,

 

i am using the following measure to caluclate the date of the most recent invoice generated 

 

Last Raised Invoice =
VAR CurrentName = SELECTEDVALUE( 'Invoice Reminder Sheet 2'[Project Title])

RETURN
MAXX( FILTER( ALL( 'Invoice Reminder Sheet 2' ), 'Invoice Reminder Sheet 2'[Project Title] = CurrentName ),
'Invoice Reminder Sheet 2'[Date EDGE Ledger raised].[Date] )
 
is there a way to reference the above measure and use IF / DATEDIFF to show if more than 180 days has elapsed since the last invoice then a new one would be due? desired outcome if >180 days "Invoice Due x days ago", if <180 Days " X days till next invoice"
1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @Anonymous ,

 

I guess it would be something like this:

 

_timeWindow =
VAR dDiff = DATEDIFF([yourMeasure], TODAY(), DAY)
RETURN
IF(
  dDiff > 180,
  "Invoice Due " & dDiff - 180 & " days ago",
  180 - dDiff & " days until next invoice"
)

 

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

4 REPLIES 4
BA_Pete
Super User
Super User

Hi @Anonymous ,

 

I guess it would be something like this:

 

_timeWindow =
VAR dDiff = DATEDIFF([yourMeasure], TODAY(), DAY)
RETURN
IF(
  dDiff > 180,
  "Invoice Due " & dDiff - 180 & " days ago",
  180 - dDiff & " days until next invoice"
)

 

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Anonymous
Not applicable

@amitchandak @BA_Pete 

 

thank you for the help

 

worked exactly as i had hoped

 

thankyou!! 😀

amitchandak
Super User
Super User

@Anonymous , You can create a new measure like

 

datediff([Last Raised Invoice], today(), day)

 

 

or

 

if(datediff([Last Raised Invoice], today(), day)  > 180, "Invoice Due 180 days ago" , "Invoice Due below 180 days ago")

Anonymous
Not applicable

unfortunately i do not seem to be able to reference the 1st measure to create this new measure

 

the above works in a calculated column

 

may be this is what i need to do

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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