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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Chanleakna123
Post Prodigy
Post Prodigy

Minus Value between past date and new date with the same description

1.PNG

 

hi everyone ,i Unpivoted the columns and it turns like this

my purpose is : 

 

On 

1/26/2019 : Double fork is 7618 and On 1/27/2019 double fork is 7634 , these both will minus : Total = 7634-7618 

1/26/2019 : Double fork3 is 7346 and On 1/27/2019 double fork3 is 7357 , these both will minus : Total = 7357-7346 

 

How to minus the number together with the new date and past date with the same description i mentioned. i mean this will be repeatedly minus if the new date have , it will minus the old date. 

 

thx 

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @Chanleakna123 ,

 

You can try to use following calculation column formula to get value diff between same attribute different date :

Diff =
VAR prev =
    CALCULATE (
        MAX ( T2[Date] ),
        FILTER (
            ALL ( T2 ),
            [Attribute] = EARLIER ( T2[Attribute] )
                && [Date] < EARLIER ( T2[Date] )
        )
    )
RETURN
    IF (
        prev <> BLANK (),
        [Value] - LOOKUPVALUE ( T2[Value], T2[Attribute], [Attribute], T2[Date], prev )
    )

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

5 REPLIES 5
v-shex-msft
Community Support
Community Support

Hi @Chanleakna123 ,

 

You can try to use following calculation column formula to get value diff between same attribute different date :

Diff =
VAR prev =
    CALCULATE (
        MAX ( T2[Date] ),
        FILTER (
            ALL ( T2 ),
            [Attribute] = EARLIER ( T2[Attribute] )
                && [Date] < EARLIER ( T2[Date] )
        )
    )
RETURN
    IF (
        prev <> BLANK (),
        [Value] - LOOKUPVALUE ( T2[Value], T2[Attribute], [Attribute], T2[Date], prev )
    )

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

@v-shex-msft  , thx you dear , it works so perfectly , you're brilliant. 

v-shex-msft
Community Support
Community Support

Hi @Chanleakna123 ,

 

I'd like to suggest you to split attribute column to two part(description and number), it should more simply to look up similar descriptions for calculate.

 

If you are confused on coding formula, please share some sample data for test.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

@v-shex-msft  i have shared link through drop box to you. can you please assist on this ? 

Thank you 

hi @v-shex-msft  still awaiting your solution . can you please help me on this ? 

Thanks 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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