# Data usage from n-th day of the month is not counted before the n-th day

My billing cycle starts at the 6th day of the month, so I set KLWP to count data starting from the sixth day. The formula I'm using to display the usage is \$ts(mt, m, 6d)\$.

Actual result: The counter stays at 0 on 1st, 2nd, 3rd, 4th, and 5th day of the month.

Expected result: Data is counted since the last 6th day of the month, even if the month has just started.

This is not a bug, the formula you are using sets the date to the 6th day of CURRENT month, you probably need to use something like this:

\$if(df(d) < 6, ts(mt, m, 6dr1m), ts(mt, m, 6d))\$

Or you can do something else like

\$ts(mt, m, if(df(d) < 6, 6dr1m, 6d))\$

Doing this way date will be set to previous month (r1m -> remove 1 month) if current day is less than the 6th.

Great, this solves my problem. I had to use capital M in "6dr1M", so my formula now looks like this:

\$mu(round, ts(mt, m, if(df(d)<6, 6dr1M, 6d))/1024, 2)\$

And it happily returns the usage in GiB. Thanks!

Yeah forgot that lower case m is for minutes, well done!

I tried this, \$if(df(d) < 20, ts(mt, A, 20dr1M), ts(mt, A, 19d))\$, as my billing cycle is the 20th however the result is not correct. My Network provider and the phones internal stats state that I have used 6mb but the formula gives a result of 2Gb. Can someone please help.