I had this for a good few months - despite bring vegan and eating an awful lot of veg and fruit I got really bunged up. I think it was caused by me switching thr types of carbs I eat (less bread, more spuds etc)
I find now I have to drink lots of liquid - 15 or so drinks in a day. Then I'm usually ok. I try not to eat potato too often either. But the worst thing for bunging up is inactivity. As for the other end of the scale I have no idea what causes that, very strange although there are a whole heap of bugs going around that have just been hitting my toileting and nothing else so could have caught a few of them? Hope it gets better soon! X