Forum Discussion
Benji_B
5 years agoFrequent Visitor
Queue Population Reset
Hi all, I am attempting to use measures to calculate the number of people in a queue at any given point at time. I have 'In' set as the number of people entering the process (let's say it's a sho...
- 5 years ago
Hi Benji_B ,
First convert measure RollingSumofCountIn; RollingSumofCountOut; QueuePopulation into columns;
Then create 2 columns as below:
flag = var _prevalue=CALCULATE(MIN('example'[Column_Q]),FILTER('example','example'[Time]<=EARLIER(example[Time])&&'example'[Column_Q]<0)) var _time=CALCULATE(min('example'[Time]),FILTER('example','example'[Column_Q]=_prevalue)) Return IF('example'[Time]=_time&&'example'[Column_Q]<0,1,0)col_Adjust = var _time=CALCULATE(MAX('example'[Time]),FILTER('example','example'[Time]<=EARLIER(example[Time])&&'example'[flag]=1)) var _q=CALCULATE(MAX('example'[Column_Q]),FILTER('example','example'[Time]=_time)) Return IF('example'[Time]<_time,'example'[Column_Q], IF('example'[Time]=_time,0, 'example'[Column_Q]-_q))And you will see:
For the related .pbix file,pls see attached.
Best Regards,
KellyDid I answer your question? Mark my post as a solution
v-kelly-msft
5 years agoCommunity Support
Hi Benji_B ,
First convert measure RollingSumofCountIn; RollingSumofCountOut; QueuePopulation into columns;
Then create 2 columns as below:
flag =
var _prevalue=CALCULATE(MIN('example'[Column_Q]),FILTER('example','example'[Time]<=EARLIER(example[Time])&&'example'[Column_Q]<0))
var _time=CALCULATE(min('example'[Time]),FILTER('example','example'[Column_Q]=_prevalue))
Return
IF('example'[Time]=_time&&'example'[Column_Q]<0,1,0)col_Adjust =
var _time=CALCULATE(MAX('example'[Time]),FILTER('example','example'[Time]<=EARLIER(example[Time])&&'example'[flag]=1))
var _q=CALCULATE(MAX('example'[Column_Q]),FILTER('example','example'[Time]=_time))
Return
IF('example'[Time]<_time,'example'[Column_Q],
IF('example'[Time]=_time,0,
'example'[Column_Q]-_q))
And you will see:
For the related .pbix file,pls see attached.
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution
- Benji_B5 years agoFrequent Visitor
Wow this is fantastic, thank you so much!