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
wooand
Helper II
Helper II

Prior Month Summaries.

I need to produce a summary of various stats for different one month periods, for example, last month, two months ago and so on.  I have used this code:

 

1m Ago Volume = CALCULATE(SUM('Results'[USD Amount]),

DATESBETWEEN('Results'[Trade Date],

Date(YEAR(EDATE(today(),-1)),MONTH(EDATE(today(),-1)),1),

EOMONTH(today(),-1)))

 

And…

 

2m Ago Volume = CALCULATE(SUM('Results'[USD Amount]),

DATESBETWEEN('Results'[Trade Date],

Date(YEAR(EDATE(today(),-1)),MONTH(EDATE(today(),-2)),1),

EOMONTH(today(),-2)))

 

The problem is that I have just updated the data to include January’s data and none of the ‘1m Ago Volume’ or ‘2m Ago Volume’ has updated.  Any ideas what I've done wrong please? 

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

Hi @wooand

 

Give this a shot

 

1m Ago Volume =
CALCULATE (
    SUM ( Results[USD Amount] ),
    DATESINPERIOD (
        Results[Trade Date],
        SELECTEDVALUE ( Results[Trade Date] ),
        -2,
        MONTH
    )
)

 or

 

1m Ago Volume =
CALCULATE (
    SUM ( Results[USD Amount] ),
    DATESINPERIOD ( Results[Trade Date], TODAY (), -2, MONTH )
)

Regards
Zubair

Please try my custom visuals

View solution in original post

1 REPLY 1
Zubair_Muhammad
Community Champion
Community Champion

Hi @wooand

 

Give this a shot

 

1m Ago Volume =
CALCULATE (
    SUM ( Results[USD Amount] ),
    DATESINPERIOD (
        Results[Trade Date],
        SELECTEDVALUE ( Results[Trade Date] ),
        -2,
        MONTH
    )
)

 or

 

1m Ago Volume =
CALCULATE (
    SUM ( Results[USD Amount] ),
    DATESINPERIOD ( Results[Trade Date], TODAY (), -2, MONTH )
)

Regards
Zubair

Please try my custom visuals

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.