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
Anonymous
Not applicable

Please help me on calculate function

Hi,

I need to implement the below logic in DAX :

If (LW_SEND_END_DATE_TIME is not NULL) and (LW_SEND_START_DATE_TIME is not NULL) and DOCUMENT_ERROR_STEP not Like "%SEND%" ) then AVG (LW_SEND_END_DATE_TIME - LW_SEND_START_DATE_TIME)

 

and I am very new at Power BI, can anyone help me on this?

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@Anonymous ,

 

You may simply try FILTERCONTAINSSTRING and AVERAGEX.

Community Support Team _ Sam Zha
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

3 REPLIES 3
mussaenda
Super User
Super User

FILTER = 

VAR ENDSTART = LW_SEND_END_DATE_TIME - LW_SEND_START_DATE_TIME RETURN IF (LW_SEND_END_DATE_TIME <> BLANK() && LW_SEND_START_DATE_TIME <> BLANK() && DOCUMENT_ERROR_STEP <> "%SEND%" , CALCULATE( AVERAGE(ENDSTART)))
 

Maybe something like this?

v-chuncz-msft
Community Support
Community Support

@Anonymous ,

 

You may simply try FILTERCONTAINSSTRING and AVERAGEX.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
AlB
Super User
Super User

Hi @Anonymous,

For an accurate response you need to show the tables in your data model involved in the calculation and explain what each element in your formula is. Without that information, i would venture this:

 

IF(NOT ISBLANK(LW_SEND_END_DATE_TIME) && NOT ISBLANK(LW_SEND_START_DATE_TIME) && DOCUMENT_ERROR_STEP<>"%SEND%", AVERAGE (LW_SEND_END_DATE_TIME - LW_SEND_START_DATE_TIME))

I'm not clear on the red part because I need the explanation mentioned above.

 

Please read through these posting tips (particularly the bits in red). By following them, you will increase the probability of getting your questions answered quickly and you will make things much easier for people trying to help.

 

 

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.