RuiRomano / pbimonitor

MIT License
216 stars 79 forks source link

Bug in LastUsageDateTime calculated columns #29

Open JamesDBartlett3 opened 1 year ago

JamesDBartlett3 commented 1 year ago

The LastUsageDateTime calculated columns are supposed to retrieve the DateTime of the current item's Last Usage from the Activity table, but they only reference the Activity[Time] column, which only contains the time of day. When these calculated columns convert Time to DateTime, the missing Date part defaults to December 30th, 1899:

image

One solution is to replace the Activity[Time] column reference in these calculated column formulas with Activity[Date] & " " & Activity[Time]:

image

LastUsageDateTimeDataset = 
    var v_id = 'Catalog - Dataset'[DatasetId]
    return MAXX(
        FILTER('Activity', Activity[DatasetId] = v_id), 
        Activity[Date] & " " & Activity[Time]
    )
LastUsageDateTimeReport = 
    var v_id = 'Catalog - Report'[ReportId]
    return MAXX(
        FILTER('Activity', Activity[ReportId] = v_id), 
        Activity[Date] & " " & Activity[Time]
    )

I wanted to open the floor for discussion about the best way to solve this problem, and any potential issues that might arise from implementing it the way I've proposed above. If I haven't heard any disagreement with my proposed solution in a few weeks time, I'll make the change myself and submit a PR.