Reply
avatar user
Anonymous
Not applicable
Partially syndicated - Outbound

Sorting calculation of interval between one date to the other

Hi guys.

 

I created the fololowing formula to count how many days I have from one date to the other:

Days Overdue = SWITCH (
TRUE (),
MIN('Incoming payments'[Receive Date]) < MIN('Output Schweinsteiger'[DUE DATE]), DATEDIFF ( MIN('Incoming payments'[Receive Date]), MIN('Output Schweinsteiger'[DUE DATE]), DAY ),
MIN('Incoming payments'[Receive Date]) > MIN('Output Schweinsteiger'[DUE DATE]), DATEDIFF ( MIN('Incoming payments'[Receive Date]), MIN('Output Schweinsteiger'[DUE DATE]), DAY )* -1
)
 
The problem rises when I want to show the two dates as the LATEST. Then, the calculation does not reflect the difference of the two dates anymore.
How to solve it?
 
Thanks,
Diego
1 ACCEPTED SOLUTION
edhans
Super User
Super User

Syndicated - Outbound

use MAX instead of MIN. If that doesn't work, you will need to provide some data and show where it is failing, or provide a PBIX file. See links below.

 

How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

4 REPLIES 4
avatar user
Anonymous
Not applicable

Syndicated - Outbound

Just a simplier question relating to this.

 

I have a table with many dates per rows and want to compare these dates to 30/06/2020.

What I did so far was the following:

 

 - Age = datediff(30/06/2020,'Gross 16-18'[End CAP Account],YEAR)
 
What I want from it is the interval from the 'Gross 16-18'[End CAP Account] compared to 30/06/2020

Did I use the formula wrongly?

 

Thanks heaps,

Diego

 
v-xuding-msft
Community Support
Community Support

Syndicated - Outbound

Hi @Anonymous ,

 

We are not clear about your requirement. Can you please share some sample data and expected results? 

 

Here are the similar threads that you could reference firstly.

https://community.powerbi.com/t5/Desktop/Days-between-based-on-slicer/m-p/491626#M229121

https://community.powerbi.com/t5/Desktop/Slicer-based-datediff/m-p/735223#M354631

 

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

Syndicated - Outbound

@Anonymous , if you are using a Measure for date diff, you need a common context to have diff. Refer my blog on this topic

https://community.powerbi.com/t5/Community-Blog/Decoding-Direct-Query-in-Power-BI-Part-2-Date-Difference-Across/ba-p/934397#M451

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
edhans
Super User
Super User

Syndicated - Outbound

use MAX instead of MIN. If that doesn't work, you will need to provide some data and show where it is failing, or provide a PBIX file. See links below.

 

How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
avatar user

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)