Forum Discussion
Set a conditional flag
- 4 years ago
I mean use the given dax formula to create a calculated column in your table.Is that what you are doing?
Home-->New column-->Paste the code there
The error is because you are using it as a measure.
Hey Anonymous ,
How does your sample data look like?
- Anonymous4 years agoNot applicable
Here is a sample of my data PC2790
In this sample, the vehicles moved each time, so they are considered active.
But let’s imagine that the first line is duplicated with a different schedule, (the 04/07/2022 at 07:05:00 with the same longitude and latitude for example), the vehicle should therefore be marked as inactive for this newline
- PC27904 years ago
Community Champion
Hey Anonymous ,
Is this what you are looking for?
Active/Inactive = var previousval = Calculate(Max(VehicleTb[PositionTimestamp]),Filter(VehicleTb,VehicleTb[PositionTimestamp]<Earlier(VehicleTb[PositionTimestamp])),ALLEXCEPT(VehicleTb,VehicleTb[Vehicle ID])) var previouslong = CALCULATE(Max(VehicleTb[Long]),VehicleTb[PositionTimestamp] = previousval) var previouslat = CALCULATE(Max(VehicleTb[Lat]),VehicleTb[PositionTimestamp] = previousval) return //previousval if(VehicleTb[Long] = value(previouslong) && VehicleTb[Lat] = value(previouslat),"InActive","Active")- Anonymous4 years agoNot applicable
This seems perfect.
However, I don’t understand why certain fields are greyed out and not taken into account. Can you help me debug the formula PC2790 ?