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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Marcoss
Frequent Visitor

Circular dependency DAX

Hello everyone,

 

I would like to calculate for each month the value of D' as the sum of A', B' and C', based on the inputs: Start (only for the first month), A' (for the first month equals "Start"), B' and C'.

 

The problem is that I only know A' for the first month (equals "Start"), and for next months A' should come from D' from the previous month.

 

So in the example below for the second month it should be:
D' = 106 (instead of 110) + 4 + 6 = 116.

 

Do you have any ideas?

 

Marcoss_1-1694673128422.png

MonthStartABC
1/1/2023100 24
2/1/2023  46
3/1/2023  68
4/1/2023  810
5/1/2023  1012
6/1/2023  1214

 

Start' = SUM('Table'[Start])
B' = SUM('Table'[B])
C' = SUM('Table'[C])
D' = [A'] + [B'] + [C']
 
A' =
VAR FirstMonth = [Start']
VAR NextMonths =
CALCULATE(
    [Start'],
    DATEADD(
        'Table'[Month],
        -1,
        MONTH
    )
)
+ [B'] + [C']
RETURN
IF(
    [Start'] <> BLANK(),
    FirstMonth,
    NextMonths
)
1 ACCEPTED SOLUTION
ChiragGarg2512
Solution Sage
Solution Sage

Hello @Marcoss,

Try this DAX for A':

A' = CALCULATE(FIRSTNONBLANKVALUE('Table (2)'[Month], [Start']), All())+CALCULATE(SUMX('Table (2)', 'Table (2)'[B]+'Table (2)'[C]), FILTER(ALL('Table (2)'), 'Table (2)'[Month]<max('Table (2)'[Month])))
 
Thank You.
 
Replace Table (2) with the table name.

View solution in original post

2 REPLIES 2
Marcoss
Frequent Visitor

Thank you, but I also solved it in another way.

Marcoss_0-1694689245806.png

A' =
VAR FirstMonth = [Start']
VAR NextMonths =
CALCULATE(
    [Start'],
    ALL('Table'[Month])
)
+
CALCULATE(
    [B'],
    'Table'[Month] < MAX('Table'[Month])
)
+
CALCULATE(
    [C'],
    'Table'[Month] < MAX('Table'[Month])
)
RETURN
IF(
    FirstMonth <> BLANK(),
    FirstMonth,
    NextMonths
)
ChiragGarg2512
Solution Sage
Solution Sage

Hello @Marcoss,

Try this DAX for A':

A' = CALCULATE(FIRSTNONBLANKVALUE('Table (2)'[Month], [Start']), All())+CALCULATE(SUMX('Table (2)', 'Table (2)'[B]+'Table (2)'[C]), FILTER(ALL('Table (2)'), 'Table (2)'[Month]<max('Table (2)'[Month])))
 
Thank You.
 
Replace Table (2) with the table name.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.