Search code examples
heatmaptableau-apilogarithm

Tableau Log Function Incorrect


Here is sample dataviz

Heatmap of linear order quantity (region vs quantity)

enter image description here

Created calculated field logarithmic = int(log([Order Quantity])) and later on logarithmic = int(log([Order Quantity],10))

Heatmap where size is based on logarithmic.

Size doesn't change and number is incorrect, please guide.

enter image description here


Solution

  • tl;dr Sum the order quantities before taking the logarithm.

    int(log(SUM[Order Quantity]))
    

    Otherwise you are taking the logarithm of each individual Order Item, and then adding the logarithms. The aggregation function, sum() in your case, is specified when you place the field on the shelf unless you make it explicit in the calculated field.

    Here are a couple of ways to use the log field, dual or triple encoding the log by size, color and shape. A custom legend works better with multiple encoded symbols than the default legends.

    enter image description here enter image description here