cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ranahazim
Frequent Visitor

using datediff with filters

hi,

i have this formula, it gave me big numbers which i think because i used sum after (claculate) i dont want to sum it, but calculate function does not allow to continue with me using sum,count,min...

i need to calculate a date difference with a filter in a third coulumn, so the desiered coulumns give months numbers and the others give blank. still trying but posting this question in the meantime

 

No_of_months since opened1 = DATEDIFF ('EVS Account'[Date_Opened],CALCULATE(SUM('EVS Account'[Date_action_code1].[Date]),FILTER('EVS Account','EVS Account'[Action_Code]="P")),MONTH)

 

thanks alot 

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

Hi @Ranahazim

I can reproduce your problem, i would suggest you to create a calculated column like this

Column = IF([Action_Code]="P",DATEDIFF([Date_Opened],[Date_action_code1],MONTH))

3.png

 

Or a measure

Measure = IF(MAX([Action_Code])="P",DATEDIFF(MAX([Date_Opened]),MAX([Date_action_code1]),MONTH))

Best Regards

Maggie

View solution in original post

1 REPLY 1
v-juanli-msft
Community Support
Community Support

Hi @Ranahazim

I can reproduce your problem, i would suggest you to create a calculated column like this

Column = IF([Action_Code]="P",DATEDIFF([Date_Opened],[Date_action_code1],MONTH))

3.png

 

Or a measure

Measure = IF(MAX([Action_Code])="P",DATEDIFF(MAX([Date_Opened]),MAX([Date_action_code1]),MONTH))

Best Regards

Maggie

View solution in original post

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

Get Ready for Power BI Dev Camp

Power BI Dev Camp - September 30th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors