3
votes

I have two identical table visuals and a measure calculating percent for category.

% = 
DIVIDE(
    [m_SalesValue]
    ,CALCULATE([m_SalesValue], ALLSELECTED('Table'[Category]))
    ,BLANK()
)

When I select (highlight) one category, say banana, then the other visual shows unexpected percent value for category. The expected value is 0.25 but it shows 1.00. How should I modify the measure to get the expected results.

enter image description here

Getting the challenge to higher level, let's assume that both visuals have been initially cross filtered by some unspecified dimension, say fruits. That is why I used ALLSELECTED instead of ALL.

Here is source table:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSiwoyElV0lEyVYrViVZKSswDQiDXAsxNzkgtKqoEcs3B3PLEktSi3NSc/DygkKGRUmwsAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Category = _t, SalesValue = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Category", type text}, {"SalesValue", Int64.Type}})
in
    #"Changed Type"
1
Including your starting data this way is pretty handy, btw.Ryan B.

1 Answers

2
votes

You'll want to use ALLEXCEPT and identify the cross-filters that you still want to apply. Your example suggests 'Fruits' so that's what I included below.

% = 
DIVIDE(
    [m_SalesValue]
    ,CALCULATE([m_SalesValue], ALLEXCEPT(Table, 'Table'[Fruits]))
    ,BLANK()
)