Forum Discussion

Ani26's avatar
Ani26
Helper III
6 years ago
Solved

Change calculated table dynamically on slicer selection

Hi Team,   Need some assistance. I have a source table as below. Source Attribute Value Date abC May BIT 20 0.1 1/5/2020 abC May AUC 20 0.23 1/5/2020 aaa May BIT 20 2.5 1/5...
  • MFelix's avatar
    6 years ago

    Hi Ani26 ,

     

    Calculated tables cannot be affect dinamically by slicers, so you cannot have a dinamic calculted table on the fly to use on a visualization, however you can create a measure that makes use of a calculated table (as a variable) and then make it dinamic with the use of slicers.

     

    I was looking at your example and didn't understood what you want to create is the Bracket part or only the filtering of the data by bit?

  • v-xuding-msft's avatar
    6 years ago

    Hi Ani26 ,

     

    As MFelix said, it can't create a calculated table dynamically based on slicers. But you can do it in measures. Here is my sample that you could have a try.

    Month-Year = DISTINCT('Date'[Month-Year])
    Bracket = 
    VAR X =
        CALCULATE (
            SUM ( 'Table'[Value] ),
            FILTER ( 'Date', 'Date'[Month-Year] = [S] )
        )
    RETURN
        SWITCH (
            TRUE (),
            X > 0
                && X < 1, "0-1",
            X >= 1
                && X < 2, "1-2",
            x > 2, ">2",
            BLANK ()
        )
    
    BIT =
    VAR BIT =
        SEARCH ( "BIT", MAX ( 'Table'[Attribute] ),, 1000 )
    RETURN
        CALCULATE (
            SUM ( 'Table'[Value] ),
            FILTER ( 'Date', 'Date'[Month-Year] = [S] && BIT <> 1000 )
        )