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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
DanCasSan
Helper V
Helper V

Disaggregate accumulated

Hello community.

 

How could I get the highlighted field? What happens is that I have the accumulated information per day, but I need to know the value of the day. I have attached an example table.

 

Capture (2).JPG

 

Thank you!

 

Regards,

Daniel Castillo

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

Hi @DanCasSan 

try a column

Column = 
var _prevDate = CALCULATE(MAX(Table[Date]), FILTER(ALL(Table), Table[CountryName] = EARLIER(Table[CountryName]) && Table[Date] < EARLIER(Table[Date]) ) )
var _thisVal = EARLIER(Table[ValueAccuum])
RETURN
_thisVal - CALCULATE(MAX(Table[ValueAccuum]), ALLEXCEPT(Table, Table[CountryName]), Table[Date] = _prevDate )

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

4 REPLIES 4
harshnathani
Community Champion
Community Champion

Hi @DanCasSan ,

 

You can create a Calculated Column

 

Column =

 

var PreviousDate =

CALCULATE (

    MAX ( 'Table'[Date] ),

    FILTER (

        ALLEXCEPT (

            'Table',

            'Table'[CountryNam]

        ),

        'Table'[Date]

            < EARLIER ( 'Table'[Date] )

    )

)

 

var _rankOrder = RANKX(FILTER('Table', 'Table'[CountryNam] = EARLIER('Table'[CountryNam])),'Table'[Date],,ASC)

 

var PreviousValAcum =

CALCULATE (

    MAX('Table'[ValueAcum]),

    FILTER (

        ALLEXCEPT (

            'Table',

            'Table'[CountryNam]

        ),

        'Table'[Date]

            < EARLIER('Table'[Date])  && 'Table'[Rank Date] = _rankOrder - 1

    )

)



return

'Table'[ValueAcum] - PreviousValAcum

 

Regards,
Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

az38
Community Champion
Community Champion

Hi @DanCasSan 

try a column

Column = 
var _prevDate = CALCULATE(MAX(Table[Date]), FILTER(ALL(Table), Table[CountryName] = EARLIER(Table[CountryName]) && Table[Date] < EARLIER(Table[Date]) ) )
var _thisVal = EARLIER(Table[ValueAccuum])
RETURN
_thisVal - CALCULATE(MAX(Table[ValueAccuum]), ALLEXCEPT(Table, Table[CountryName]), Table[Date] = _prevDate )

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

@az38 thank you!
This worked perfectly for me

 

Regards,

Daniel Castillo

harshnathani
Community Champion
Community Champion

Hi @DanCasSan ,

 

Check out this blog.

 

You can get the previous date and value in the same row and then subtract the value of the columns

 

http://harshnathani.blogspot.com/2020/06/find-previous-details-of-customer-in.html

 

 

 

Column =

 

var PreviousDate =

CALCULATE (

    MAX ( 'Table'[Date] ),

    FILTER (

        ALLEXCEPT (

            'Table',

            'Table'[CountryNam]

        ),

        'Table'[Date]

            < EARLIER ( 'Table'[Date] )

    )

)

 

var _rankOrder = RANKX(FILTER('Table', 'Table'[CountryNam] = EARLIER('Table'[CountryNam])),'Table'[Date],,ASC)

 

var PreviousValAcum =

CALCULATE (

    MAX('Table'[ValueAcum]),

    FILTER (

        ALLEXCEPT (

            'Table',

            'Table'[CountryNam]

        ),

        'Table'[Date]

            < EARLIER('Table'[Date])  && 'Table'[Rank Date] = _rankOrder - 1

    )

)



return

'Table'[ValueAcum] - PreviousValAcum

 

 

Regards,

Harsh Nathani

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.