Forum Discussion
mailwin33
9 years agoFrequent Visitor
Calculate maximum time with grouping earlier rows
Hello, everyone! I stucked with writing a DAX formula that I can't manage to during the week. I have a table that contains data about guests visited our building (with electronic cards. Also we hav...
Sean
Community Champion
9 years agomailwin33 I suspect you are creating a COLUMN by the error you get
Vvelarde's formula is for a MEASURE
mailwin33
9 years agoFrequent Visitor
Sorry, it looks like I disappointed you.
Measure seems to work (at least works different).
Formula accepted successfully but when I try to add this measure to report it begins to roll the loading indicator and extremely consuming CPU, although ALLEXCEPT specified Enter Date and filter is set for today.
Measure seems to work (at least works different).
Formula accepted successfully but when I try to add this measure to report it begins to roll the loading indicator and extremely consuming CPU, although ALLEXCEPT specified Enter Date and filter is set for today.
- Sean9 years ago
Community Champion
mailwin33 Try this as a COLUMN - no MAX and no VALUES
LastExitTime COLUMN = VAR ExitTime = BuildingVisits[BuildingExitTime] RETURN CALCULATE ( MAX ( BuildingVisits[BuildingExitTime] ), FILTER ( ALLEXCEPT ( BuildingVisits, BuildingVisits[BuildingID], BuildingVisits[EnterDate] ), BuildingVisits[BuildingEnterTime] < ExitTime && MAX ( BuildingVisits[EnterDate] ) = TODAY () ) )If you want this calculated only for TODAY( ) try this as a COLUMN as well
LastExitTime COLUMN 2 = IF ( BuildingVisits[EnterDate] = TODAY (), VAR ExitTime = BuildingVisits[BuildingExitTime] RETURN CALCULATE ( MAX ( BuildingVisits[BuildingExitTime] ), FILTER ( ALLEXCEPT ( BuildingVisits, BuildingVisits[BuildingID] ), BuildingVisits[BuildingEnterTime] < ExitTime ) ) ) - mailwin339 years agoFrequent Visitor
Thank you for the suggestion.
I believe it should works, but in my case it stucks on "Working on it" (both formulas), likely because of lot of rows, trying to loop throuh all of them, regardless I set a filter on EnterDate and use TODAY() in formula
Ok, thank you.
I'll think about how to anonimize my data and share it.