Forum Discussion

alchen00's avatar
alchen00
Helper I
3 years ago
Solved

Avoid Repeating Virtual Table in Every Measure

I have a dynamic chart that changes its appeareance based on selection in a table.  In the example below the orange curve line is the generated result.  I used a Virtual Table (via Summarize) to spee...
  • johnt75's avatar
    3 years ago

    I don't think there's a way to avoid having the code in each measure, but you might get a performance boost by using ADDCOLUMNS to add the calculated columns rather than SUMMARIZE. 

    ADDCOLUMNS (
        SUMMARIZE (
            FILTER (
                ALL ( Data ),
                Data[Date] >= MinDate
                    && Data[Date] <= MaxDate
                    && Data[Ticker] = Ticker
            ),
            Data[Date]
        ),
        "L", CALCULATE ( MIN ( Data[Low] ) ),
        "_RUN", [_Run]
    )