Are you able to write these calculations directly within the data source? Alternatively raw sql calculations may do the job: Using Raw SQL Functions | Tableau Software
Depending on how you use the LOD calcs they're often better written directly in the underlying data source, they can cause performance issues while calculating within a workbook.
It looks like the LOD parts in both calcs are simply to filter
the [REG] value ranked # 1 by COUNT([REG]) DESC.
If it makes sense, then the following RAWSQL function could help:
"rank() over( order by count(%1) desc )"
, [REG] ) = 1
THEN ATTR( [REG] )