Forum Discussion
GovindPrajapat
3 years agoFrequent Visitor
Complex DAX Operation
Hi, I have a live streaming dataset in power bi. The data transformation feature, Add new coloumn and create new table all of this features are disabled for live streaming data. The operation that i ...
Sahir_Maharaj
3 years agoSuper User
Hello GovindPrajapat,
Since you don't have an index column and the data transformation features are disabled for live streaming data, you can achieve your desired calculations using DAX measures instead.
1. Create Measures
1.1. Difference between In DateTime and Out DateTime
In_Out_Difference =
VAR CurrentDateTime = MIN('YourTable'[DateTime])
VAR NextDateTime = CALCULATE(MIN('YourTable'[DateTime]), 'YourTable'[DateTime] > CurrentDateTime, 'YourTable'[Tag] = "Out", 'YourTable'[PlatformId] = EARLIER('YourTable'[PlatformId]))
RETURN
IF('YourTable'[Tag] = "In" && NOT(ISBLANK(NextDateTime)), NextDateTime - CurrentDateTime)1.2. Difference between Work DateTime and EndStart DateTime
Work_EndStart_Difference =
VAR CurrentDateTime = MIN('YourTable'[DateTime])
VAR NextDateTime = CALCULATE(MIN('YourTable'[DateTime]), 'YourTable'[DateTime] > CurrentDateTime, 'YourTable'[Tag] = "EndStart", 'YourTable'[PlatformId] = EARLIER('YourTable'[PlatformId]))
RETURN
IF('YourTable'[Tag] = "Work" && NOT(ISBLANK(NextDateTime)), NextDateTime - CurrentDateTime)1.3. Difference between EndStart DateTime and EndClose DateTime
EndStart_EndClose_Difference =
VAR CurrentDateTime = MIN('YourTable'[DateTime])
VAR NextDateTime = CALCULATE(MIN('YourTable'[DateTime]), 'YourTable'[DateTime] > CurrentDateTime, 'YourTable'[Tag] = "EndClose", 'YourTable'[PlatformId] = EARLIER('YourTable'[PlatformId]))
RETURN
IF('YourTable'[Tag] = "EndStart" && NOT(ISBLANK(NextDateTime)), NextDateTime - CurrentDateTime)2. Create visuals using these measures to display the time differences for each platform based on the "Tag" values.
Should you require further assistance please do not hesitate to reach out to me.