gauges drop need help

Earlier I was going down the road and my gauges dropped and lights got dim and car ran like shit and wanted to die and I really need to know what it is bc it's done that before and a new battery fixed it. I think its something electrical or the alternator idk. Please help any info is appreciated