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
walnutmercury
Frequent Visitor

Previous Value By Region etc

Hi

 

Might be very simple, but I need your help. My Dataset looks like the below, and I need to create the Previous Week Value as well as Totals by Date, by Delta Date.

 

The previous week should Match the Region, Area & Date. The DeltaDate is the snapshot date as I need to track the Amount in $ and % over the snapshot dates.

 

Thanks In advanced.

 

RegionAreaDateDeltaDateAmountPrevious Week
NorthA1Jan-185/10/2018200 
NorthA2Jan-185/10/2018300 
NorthA2Feb-185/10/2018200 
WestA1Feb-185/10/2018100 
WestA2Mar-185/10/2018400 
WestA2Apr-185/10/2018900 
southA1Jan-185/10/201810 
southA2Jan-185/10/20182 
southA2Feb-185/10/201843 
NorthA1Jan-1828/09/201856200
NorthA2Jan-1828/09/2018123300
NorthA2Feb-1828/09/2018452200
WestA1Feb-1828/09/2018400100
WestA2Mar-1828/09/201820400
WestA2Apr-1828/09/201819900
southA1Jan-1828/09/20181510
southA2Jan-1828/09/2018762
southA2Feb-1828/09/20188943
NorthA1Jan-1821/09/201810056
NorthA2Jan-1821/09/2018400123
NorthA2Feb-1821/09/2018900452
WestA1Feb-1821/09/201810400
WestA2Mar-1821/09/2018220
WestA2Apr-1821/09/201840019
southA1Jan-1821/09/20185615
southA2Jan-1821/09/201812376
southA2Feb-1821/09/201840089
2 REPLIES 2
walnutmercury
Frequent Visitor

Any help on this would be appreciated.

Hi @walnutmercury,

 

You can refer to following calculated column formula to get previous amount:

previous Amount =
VAR previous =
    CALCULATE (
        MAX ( Sample[DeltaDate] ),
        FILTER (
            ALL ( 'Sample' ),
            [Region] = EARLIER ( [Region] )
                && [Area] = EARLIER ( [Area] )
                && [DeltaDate] < EARLIER ( [DeltaDate] )
        )
    )
RETURN
    MAXX (
        FILTER (
            ALL ( 'Sample' ),
            [Region] = EARLIER ( [Region] )
                && [Area] = EARLIER ( [Area] )
                && [DeltaDate] = previous
        ),
        [Amount]
    )

1.PNG

 

Regards,

Xiaoxin Sheng

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

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.