Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
How to calculate "2023/04/01"-"2023/03/02"?
Hello @louise119
To calculate the number of days between two dates in Qlik Sense, you can use the following formula:
=Date#('2023/04/01', 'YYYY/MM/DD') - Date#('2023/03/02', 'YYYY/MM/DD')
This formula uses the Date#
function to convert the dates from text format to date format, and then subtracts the earlier date from the later date to get the number of days in between.
Alternatively, you can use the Interval
function to calculate the interval between two dates in a specific unit, such as days:
=Interval('2023/04/01' - '2023/03/02', 'DD')
This formula subtracts the earlier date from the later date and returns the interval in days.
Both of these formulas should give you the same result, which is 30.
=Interval(Date(2023/04/01,'MM/DD/YYYY')- Date(2023/03/02,'MM/DD/YYYY'),'DD')
=Floor(Date(2023/04/01,'YYYY/MM/DD')- Date(2023/03/02,'YYYY/MM/DD'))