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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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