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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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