JWBG
JWBG

Reputation: 1506

Tableau: How to do conditional formatting of two different metrics by a Parameter

I have the parameter "Metrica", to see 1) headcount or 2) amount

I am using this formula to convert metrics to a string to show:

CASE [Métrica]
WHEN 'Conteo' THEN  str(COUNTD( [paracontar] ))
ELSE left(str( int( sum([Amount])/ 100000) / 10  ),6) + 'M'
END

When the parameter "Metrica" is on 'Conteo' the string is OK, But when is not on 'Conteo' then string appears with so many decimals like '2.399999M'

How to do this conditional formating taking out many decimals into the string?

you can see the string with so many decimals

Upvotes: 0

Views: 81

Answers (1)

Jose Cherian
Jose Cherian

Reputation: 7757

CASE [Métrica]
WHEN 'Conteo' THEN  str(COUNTD( [paracontar] ))
ELSE str(ROUND((sum([Amount])/ 1000000)),1) + 'M'
END

Upvotes: 2

Related Questions