Forum Discussion

JayWee's avatar
JayWee
Frequent Visitor
1 year ago
Solved

Deneb: Use Calculation For Window Frame

Hi All,   Can i please find out whether does vega lite support calculation values in the Frame? Please advie.   Thanks in advance.   Jay    
  • Akash_Varuna's avatar
    1 year ago

    Hi JayWee According to the Vega-Lite documentation, frame expects an array with two elements:

    • The start of the frame relative to the current data object.
    • The end of the frame relative to the current data object.

    the frame property does not support dynamic expressions or calculations parseInt(datum.MvgAVG) * -1 .

    It requires static numeric values or null. 
    For more details on transformations please check this documentation Vega-Lite Window Transform documentation.
    If this post helped please do giev a kudos and accept this as a solution
    Thanks In Advance

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi JayWee,

    Thank you for reaching out in Microsoft Community Forum.

    Thank you Akash_Varuna  for the helpful response.

    Please follow below steps to replace the start frame using slicer;

    1.Vega-Lite's frame property only accepts static numeric values (e.g., [-1, 1]) — it cannot use dynamic expressions like parseInt(datum.X) or respond to slicers.

    2.Slicers in Power BI cannot dynamically control frame in a Vega-Lite spec — it’s not interactive in that way.

    3.To achieve dynamic behavior, perform the calculation in DAX or Power Query and pass the result to Vega-Lite.

    4.Alternatively, use native Power BI visuals for dynamic rolling windows or frame-based calculations.

    Please continue using Microsoft Community Forum.

    If this post helps in resolve your issue, kindly consider marking it as "Accept as Solution" and give it a 'Kudos' to help others find it more easily.

    Regards,
    Pavan.