datediff
72 TopicsTracking Number of Days Between CVE Found/Remediated/Still Open,
Days to Remediation Calculations.pbix and Remediation Time Test.xlsx Still not there yet...close but not working as desired. What I need is to be able to figure out how many days a vuln has been open, either from first appearance if never remediated, or from its last appearance if it's been remediated previously and is still open. Nothing I have tried has solved that completely. Conditions of proper calculation: 1. If EndOcc = 0 from the date of its first BeginOccDate until today, the total # of days should be displayed. 2. If EndOcc = 1 and the CVE does not reappear, the total # of days should be 0 after that date. 3. If EndOcc = 1 and the CVE reappears in a later scan (new BeginOccDate), the day count should begin from there. I've created a CVESummaryTable that creates 4 calculated columns. This sets up the conditions for using the calculated columns. CVESummaryTable = SUMMARIZE( 'FactSourceCSVs', 'FactSourceCSVs'[CVE-HostKey-PluginOutputHash], "FirstBeginOccDate", MIN('FactSourceCSVs'[BeginOccDate]), "LastBeginOccDate", MAX('FactSourceCSVs'[BeginOccDate]), "FirstEndOccDate", MIN('FactSourceCSVs'[EndOccDate]), "LastEndOccDate", MAX('FactSourceCSVs'[EndOccDate]) ) These are used to count the days; cve_days_open seems to count the days a CVE is open, but doesn't count to today if there's no EndOcc = 1; that case results in days open = 0. cve_days_open = IF( ISBLANK(CVESummaryTable[LastBeginOccDate]), // Changed FirstBegin to FirstEnd to check for "No Remediations, Ever" DATEDIFF(CVESummaryTable[LastEndOccDate], TODAY(), DAY), DATEDIFF(CVESummaryTable[FirstBeginOccDate], CVESummaryTable[LastEndOccDate], DAY) + 0) cve_days_open_til_today counts to today, but doesn't take into account subsequent occurrences (i.e. per the attached .pbix: CVE-2024-1212 is opened on 2/22/2026, closed on 2/22/2026, and opened again on 4/5 but not closed, and days open is -42) cve_days_open_til_today = IF( ISBLANK(CVESummaryTable[LastEndOccDate]), DATEDIFF(CVESummaryTable[LastBeginOccDate], TODAY(), DAY), DATEDIFF(CVESummaryTable[LastBeginOccDate], CVESummaryTable[LastEndOccDate], DAY) // DATEDIFF(CVESummaryTable[LastBeginOccDate], TODAY(), DAY) + 0) I think cve_days_open_til_today is headed in the right direction. I need to figure out how to reset the day count when there's an EndOcc = 1 so that the next BeginOcc for that CVE is set to be the reference starting date.Solved444Views1like9CommentsBacklog average age by day
Hi, I need to calculate the average age of active tickets relatively to each day in my calendar table on the X axis. The way it is calculated is by adding +1 for each day where the ticket isn't solved (between start and end dates) and where the status is 0. Then the average is calculated on active tickets by date. Below an example of what I am trying to achieve : My datamodel is as follow : Thanks for the help.Solved2.3KViews0likes14CommentsDetermine & Display Number of Days Between CVE Found/Remediated or Found/Still Open
I've been struggling with this for a while. We need to track how log it takes us to remediate CVEs (vulnerabilities) found in our Nessus scans, and how long the unresolved CVEs have been in the system. We're using a combination of the CVE, hostname, and unique hash of the Plugin output (CHP) as a key. These examples will show how the CHP is used to tie the CVE Begin & End dates together, and how the CHP remains the same over multiple scans. Scan Date CVE Host Begin End CVE-HostKey-PluginOutputHash cve_days_open 1/28/2024 CVE-2024-20918 examplehost 1/28/2024 cve-2024-20918-examplehost-a466957fef65cfd2a9416a8eeb5067d18d38af3a1b40e0b6d4a69bd189260624 1/29/2024 CVE-2024-20918 examplehost 1/29/2024 cve-2024-20918-examplehost-a466957fef65cfd2a9416a8eeb5067d18d38af3a1b40e0b6d4a69bd189260624 1/28/2024 CVE-2024-20918 examplehost 1/28/2024 cve-2024-20918-examplehost-f6176e330c108379f7c8fd1b5978a4e3296fb274d31cecb2b478445db1d2b030 4/15/2024 CVE-2024-20918 examplehost 4/15/2024 cve-2024-20918-examplehost-f6176e330c108379f7c8fd1b5978a4e3296fb274d31cecb2b478445db1d2b030 2/20/2024 CVE-2024-20918 examplehost 2/20/2024 cve-2024-20918-examplehost-c6f337b1626549bce201454fcf360e1aba07526bd1511b703aff03c93d31f1c9 2/24/2024 CVE-2024-20918 examplehost 2/24/2024 cve-2024-20918-examplehost-c6f337b1626549bce201454fcf360e1aba07526bd1511b703aff03c93d31f1c9 3/5/2024 CVE-2024-20918 examplehost 3/5/2024 cve-2024-20918-examplehost-ef289f0f3ad104a3e9c4b87f55dabf4631879f15a42ac5be8ea865976437eadc 3/18/2024 CVE-2024-20918 examplehost 3/18/2024 cve-2024-20918-examplehost-ef289f0f3ad104a3e9c4b87f55dabf4631879f15a42ac5be8ea865976437eadc Scan Date CVE Host Begin End CVE-HostKey-PluginOutputHash cve_days_open 4/24/2024 CVE-2024-20918 examplehost 4/24/2024 cve-2024-20918-examplehost-b492473916cffcfe73b0000539f2273a8cf169cc11bc8d0cd55d47c39667ad7d 5/8/2024 CVE-2024-20918 examplehost cve-2024-20918-examplehost-b492473916cffcfe73b0000539f2273a8cf169cc11bc8d0cd55d47c39667ad7d 5/13/2024 CVE-2024-20918 examplehost cve-2024-20918-examplehost-b492473916cffcfe73b0000539f2273a8cf169cc11bc8d0cd55d47c39667ad7d 5/20/2024 CVE-2024-20918 examplehost cve-2024-20918-examplehost-b492473916cffcfe73b0000539f2273a8cf169cc11bc8d0cd55d47c39667ad7d 6/4/2024 CVE-2024-20918 examplehost cve-2024-20918-examplehost-b492473916cffcfe73b0000539f2273a8cf169cc11bc8d0cd55d47c39667ad7d 6/20/2024 CVE-2024-20918 examplehost cve-2024-20918-examplehost-b492473916cffcfe73b0000539f2273a8cf169cc11bc8d0cd55d47c39667ad7d 6/24/2024 CVE-2024-20918 examplehost cve-2024-20918-examplehost-b492473916cffcfe73b0000539f2273a8cf169cc11bc8d0cd55d47c39667ad7d 6/26/2024 CVE-2024-20918 examplehost 6/26/2024 cve-2024-20918-examplehost-b492473916cffcfe73b0000539f2273a8cf169cc11bc8d0cd55d47c39667ad7d The table name is 'FactSourceCSV' The elements would be: 'FactSourceCSV'[Begin] 'FactSourceCSV'[End] 'FactSourceCSV'[CVE-HostKey-PluginOutputHash] The results/running sum would go into 'FactSourceCSV'[cve_days_open] I don't know if this is supposed to be a measure, calculated column, or done in the visualization. I've tried all three, with no success. Filtering on the CHP never seems to work right.Solved1.2KViews0likes6CommentsDAX - DateDiff not working correctly
I'm using a DAX expression to compare a date column to todays date and enter a comment in a column based on the dfference. However it appears that the DATEDIFF function is not working on dates after July 3rd 2024. I can update the field to 7/3/2024 and it functions correctly, but entering 7/4/2024 it does not. ****** PlanCompliance = IF( ISBLANK('Plans-DR'[Expires]), "No Plan Dates", IF( DATEDIFF('Plans-DR'[Expires], TODAY(), DAY) > 300, "Non-Compliant", "Compliant" ) )Solved1.8KViews0likes6CommentsDateDiff giving negative result when the next date-time is less than 24 hrs difference
This is for a calculated column. Whenever the [exit time] is the next day, but within 24 hours of [enter time], I get a negative result for minutes. All other aspects, except this, are working fine. Minutes = VAR _NonWorkingDays = CALCULATE( COUNTROWS('Calendar'), 'Calendar'[Day Type] <> "Work Day" ) VAR _WorkTimeElapsed = DATEDIFF(AuditLog[Enter_Time],AuditLog[Exit_Time], MINUTE) - (_NonWorkingDays* 24 * 60) RETURN _WorkTimeElapsed1.3KViews0likes4CommentsUnable to create measure with DAX because my columns are not recognized.
From my DATA I have many columns with dates and null values. I want to use DATEDIFF so I can have the days betweens some columns, however when I use DAX it does not recognize my columns. The dates are in the correct format, I tried Co-pilot and the solutions does not apply. I really need some help to figure out how to fix it... Tese are the columns: DAX does not find the column...Solved1.5KViews0likes8CommentsCalculate Days in Two Months Based on Start and End Date
EVALUATE VAR StartDate = DATE(2024, 9, 17) VAR EndDate = DATE(2024, 10, 5) -- Find the last day of the start month (September) VAR EndOfStartMonth = EOMONTH(StartDate, 0) -- Calculate the number of days in the start month (September) VAR DaysInStartMonth = DATEDIFF(StartDate, EndOfStartMonth, DAY) + 1 -- Calculate the number of days in the end month (October) VAR StartOfEndMonth = DATE(YEAR(EndDate), MONTH(EndDate), 1) VAR DaysInEndMonth = DATEDIFF(StartOfEndMonth, EndDate, DAY) + 1 -- Return the result RETURN UNION ( ROW ( "Month", FORMAT(MONTH(StartDate), "mmmm", "en-US"), "Days", DaysInStartMonth ), ROW ( "Month", FORMAT(MONTH(EndDate), "mmmm", "en-US"), "Days", DaysInEndMonth ) ) without using format function i get correct month like 09,10 as month. but when i pass month(startDate) to format function returns only January as month. Any why it does that? Month Days January 14 January 5 I want to get Month Days September 14 October 5Solved908Views0likes3CommentsDATEDIFF between two dates or if one date isn't given DATEDIFF between one date and today
I am creating a new column to identify the cycle time for projects. I want to create a formula so that I datediff from the start date to the complete date and if there is not a complete date (complete date is blank) I want to datediff from the start date to today. Thank you for your help. Project Start Date Project Complete Date Project Cycle Time 1/15/2024 1/31/2024 2/9/2024 3/5/2024 6/1/2024 1/16/2024 2/27/2024 6/5/2024Solved831Views0likes2CommentsDAX for datediff of values different rows
Hi, I am trying to use datediff in a column to gather the number of days between two events. I'm unable to produce the data. I think it something small I am missing, but I cannot figure it out. Here is a visual of my data. On the lefthand side, it is displaying each user, then a created receipts date and a created results date. For the item below, the Results date and Receipts date are two different events for the same user. I am trying to calculate the amount of time from Receipt to Results. I can provide a bit more information but hopefully this is enough to gather needed support. Thank you in advanceSolved1.6KViews0likes6CommentsDatediff of several periods that fall within a range
Hi! I've been trying to get the total of days from different periods that fall within a range. I have a table with PERHH_PERSO (key for worker), with several PERHH_CONTRATO (number of contract), each with a PERHH_FEC_INI (start date) and PERHH_FEC_FIN (end date). For each contract, I establish a range from the Start_date to +364 days, in a calculated column (Day_end_period). I also have a calculated column for the Datediff of the actual contract (Actual_ctr_days) What I need is to count all days from all contracts of that same person (PERHH_PERSO) that fall within that range (from PERHH_FEC_INI to Day_end_period) Here is an extract of the table, with just one person selected: I'm not getting the logic of the calculation here... have tried several approaches but none is working. Help will be much appreciatted. Thanks!Solved1.1KViews0likes4Comments