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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
JeroenHD
Helper I
Helper I

How to Sum Values based on (Value -1) from other column

Hello Community Members, 

I am struggeling with the following. I have a fairly simple table. No date dimensions unfortunately. 
The rows contain a period number. Which can be from 1 - 12. I need a measure where the amount is summed. 
It's conditional. Where period is 1 it should sum the amount where period is 1. If period is 2 it should Sum the amount of Period 2 - Period 1. If period is 3 it should Sum the amount of Period 3 - Sum of Period 2 etc. 

I tried a lot with selected value and MAX, but it gave me the true / false error, so obviously i am doing something wrong.

Can anybody help me out? 
See table below for reference.

JeroenHD_0-1655378705249.png

 

Kind regards, 
Jeroen

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @JeroenHD,

Can you please share some more detail about these table structures and relationship mapping?

How to Get Your Question Answered Quickly  

You can extract the second table relationship key values based on the current selection, and use these extract values as conditions to filter on the first table.

formula =
VAR selected =
    CALCULATETABLE ( VALUES ( Table2[key] ), ALLSELECTED ( Table2 ) )
RETURN
    CALCULATE (
        SUM ( Table1[Amount] ),
        FILTER ( ALLSELECTED ( Table1 ), [key] IN selected )
    )

Regareds,

Xiaoxin Sheng

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @JeroenHD,

Can you please share some more detail about these table structures and relationship mapping?

How to Get Your Question Answered Quickly  

You can extract the second table relationship key values based on the current selection, and use these extract values as conditions to filter on the first table.

formula =
VAR selected =
    CALCULATETABLE ( VALUES ( Table2[key] ), ALLSELECTED ( Table2 ) )
RETURN
    CALCULATE (
        SUM ( Table1[Amount] ),
        FILTER ( ALLSELECTED ( Table1 ), [key] IN selected )
    )

Regareds,

Xiaoxin Sheng

Helpful resources

Announcements
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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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