Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Trying to calculate Moving Range

Getting this error.

OMoore_0-1698935030950.png

Moving Range =

VAR EarlierTime =
    CALCULATE (
        MAX ( SPC[Date] ),
        FILTER (
            ALLSELECTED(SPC[Date]),
            SPC[Date] < SELECTEDVALUE ( SPC[Date])
        )
    )
VAR EarlierMeasureValue =
    CALCULATE ( SUM ( SPC[LastDone] ), SPC[Date] = EarlierTime)
RETURN
ABS ( EarlierMeasureValue - SUM ( SPC[LastDone] ))
 
LastDone is calculated as:
LastDone =
VAR _latest =
    GROUPBY (
        'GIS Request Monitor',
        'GIS Request Monitor'[Date],
        "@latest", MAXX ( CURRENTGROUP (), 'GIS Request Monitor'[Date_Time] )
    )
RETURN
    CALCULATE (
        SUM ( 'GIS Request Monitor'[Done_per_Day] ),
        TREATAS ( _latest, 'GIS Request Monitor'[Date], 'GIS Request Monitor'[Date_Time] )
    )
   
Any ideas?
2 REPLIES 2
Anonymous
Not applicable

Hi  @Anonymous ,

 

According to the description of the error message, this is a circular dependency problem, when two object columns A, B depend on each other, when calculating A, it depends on B, but when calculating B, it needs to depend on A, then the engine does not know which object to calculate first.

 

You can check the following to understand and avoid circular dependencies:

Understanding circular dependencies in DAX - SQLBI

Avoiding circular dependency errors in DAX - SQLBI

Avoiding circular dependency errors in DAX - SQLBI

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

Read up on the new Windowing functions.

 

Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
If you are unsure how to do that please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.

If you want to get answers faster please refer to https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.