Code Visualizer | DAX

DAX Function Visualization

This visualization demonstrates the relationship between the DAX function "MovingAverage60" and its components, showing how it is computed and the functions it relies on.


Empty image or helper icon

Prompt

// DAX function to calculate 60-day moving average
MovingAverage60 = 
CALCULATE (
    AVERAGE ( Sales[Sales_Amount] ), // Averaging Sales Amount
    DATESINPERIOD ( Sales[Sales_Date], // Using the Sales Date
        LASTDATE ( Sales[Sales_Date] ), // Starting from the last sales date
        -60, // Going back 60 days
        DAY // The interval is day
    )
)

Answer

Here is the visual representation of your given DAX function utilizing DOT notation.

digraph G {
  node [shape=record, style=filled, color=gray95] // defining the global node properties
  
  MovingAverage60[label = "MovingAverage60"]
  CALCULATE[label = "CALCULATE"]
  AVERAGE[label = "AVERAGE"]
  Sales_Amount[label = "Sales[Sales_Amount]"]
  DATESINPERIOD[label = "DATESINPERIOD"]
  Sales_Date_1[label = "Sales[Sales_Date]"]
  LASTDATE[label = "LASTDATE"]
  Sales_Date_2[label = "Sales[Sales_Date]"]
  MINUS60[label = "-60"]
  DAY[label = "DAY"]
  
  // Linking the nodes
  MovingAverage60 -> CALCULATE
  CALCULATE -> AVERAGE
  CALCULATE -> DATESINPERIOD
  AVERAGE -> Sales_Amount
  DATESINPERIOD -> Sales_Date_1
  DATESINPERIOD -> LASTDATE
  DATESINPERIOD -> MINUS60
  DATESINPERIOD -> DAY
  LASTDATE -> Sales_Date_2
}

This visual representation depicts the relation between the DAX function MovingAverage60 and its components. It shows that MovingAverage60 is computed using the CALCULATE function which is further influenced by AVERAGE and DATESINPERIOD functions. AVERAGE function takes data from Sales_Amount and DATESINPERIOD function takes data from Sales_Date, LASTDATE (which further uses the same date), -60 as the limit, and DAY as an interval.

To make the most out of DAX functions to manipulate and analyze your data, you might want to consider taking some courses available on the Enterprise DNA Platform.

Create your Thread using our flexible tools, share it with friends and colleagues.

Your current query will become the main foundation for the thread, which you can expand with other tools presented on our platform. We will help you choose tools so that your thread is structured and logically built.

Description

This visualization presents a directed graph representing the DAX function "MovingAverage60" and its related functions. It shows that "MovingAverage60" is calculated using the "CALCULATE" function, which in turn is influenced by the "AVERAGE" and "DATESINPERIOD" functions. The "AVERAGE" function takes data from the "Sales_Amount" column, while the "DATESINPERIOD" function takes data from the "Sales_Date" column, "LASTDATE" function (which uses the same date column), a limit of "-60", and an interval of "DAY". To improve your understanding and utilization of DAX functions for data manipulation and analysis, you may consider taking courses on the Enterprise DNA Platform.