最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

tableau desktop - Any way to get my % of total str to format in this INT() calc? - Stack Overflow

programmeradmin1浏览0评论

I have a calc where I want to produce a continuous measure based on a case statement. I want the strings to format sufficient based on if I want '%' or not. The hours and FTE selections work correctly to populate separators, but the % of total selection results in nulls. I imagine because I'm wrapping an INT() around this calc so that I can create a continuous measure to model via a heatmap. Is there another way to do this?

INT(CASE [CIO Capacity Metrics Parameter]
    WHEN '%' THEN
        CASE [Incl. / Excl. OOO Parameter]
            WHEN 0 THEN STR(ROUND(100*(SUM([HRS_HOURS])/TOTAL(SUM([HRS_HOURS]))),0)) + '%'
            ELSE STR(ROUND(100*(SUM([Hours Total (Excl. OOO)])/TOTAL(SUM([Hours Total (Excl. OOO)]))),0)) + '%'  
        END
    WHEN 'FTE' THEN 
        CASE [Incl. / Excl. OOO Parameter]
            WHEN 0 THEN REGEXP_REPLACE(STR(ROUND(SUM([HRS_MONTH_FTE]),0)),"(\\d)(?=(\\d{3})+$)", "\\1," )
            ELSE REGEXP_REPLACE(STR(ROUND(SUM([FTE Total (Excl. OOO)]),0)),"(\\d)(?=(\\d{3})+$)", "\\1," )
        END
    WHEN 'Hours' THEN
        CASE [Incl. / Excl. OOO Parameter]
            WHEN 0 THEN REGEXP_REPLACE(STR(ROUND(SUM([HRS_HOURS]),0)),"(\\d)(?=(\\d{3})+$)", "\\1," )
            ELSE REGEXP_REPLACE(STR(ROUND(SUM([Hours Total (Excl. OOO)]),0)),"(\\d)(?=(\\d{3})+$)", "\\1," )
        END
END)

发布评论

评论列表(0)

  1. 暂无评论