Forum Discussion
alchen00
3 years agoHelper I
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...
- 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] )
johnt75
3 years agoSuper User
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]
)- alchen003 years agoHelper I
Thank you for your wisdom. I implemented the solution and got a 40% time reduction (360ms vs 213ms). On a combined basis hope it make it more efficient. Thank you again.