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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
tropic
Frequent Visitor

datediff for dates used in filters

I am struggling to find the correct dax expression for this. i have a date column which is used as a filter in the dashboard. then i have another column (deadline date) as part of the data. I wanted to create a column/measure that would give me the difference between whatever date is filtered and the deadline date. 

 

so for example, i filtered to Nov 10, and project 1 is due on Nov 30, the measure/column would give me 20 days as a result. 

 

the intention is to group the projects that are due in the next weeks/months using bucks/bins. any help?

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @tropic,

 

Taking into acount that you are using a slicer to filter your dashboard you need to create a measure, or different metrics depending on the bin.

 

The basic calculation will be something similar to this:

Days difference =
VAR _TempTable =
    ADDCOLUMNS (
        Table,
        "_DaysDifference", DATEDIFF ( Table[DeadlineDates], MAX ( SlicerTable[DateColumn] ), DAY )
    )
RETURN
    MAXX ( _TempTable, [_DaysDifference] )

 

This will give you the value per each line of your table of the difference then you need to calculate the buckets, this can be done using a table with the values of the bins.

 

Can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.

If the information is sensitive please share it trough private message.

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

1 REPLY 1
MFelix
Super User
Super User

Hi @tropic,

 

Taking into acount that you are using a slicer to filter your dashboard you need to create a measure, or different metrics depending on the bin.

 

The basic calculation will be something similar to this:

Days difference =
VAR _TempTable =
    ADDCOLUMNS (
        Table,
        "_DaysDifference", DATEDIFF ( Table[DeadlineDates], MAX ( SlicerTable[DateColumn] ), DAY )
    )
RETURN
    MAXX ( _TempTable, [_DaysDifference] )

 

This will give you the value per each line of your table of the difference then you need to calculate the buckets, this can be done using a table with the values of the bins.

 

Can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.

If the information is sensitive please share it trough private message.

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.