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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Syk
Super User
Super User

Cumulative measure that stops at 12 months

Hey there!
I have a cumulative measure written as such:

Cumulative measure = 
VAR firstvisibledate =
    MIN ( fact_Economic_Details[Production_Date] )
VAR lastvisibledate =
    MAX ( fact_Economic_Details[Production_Date] )
VAR lastproddate =
    CALCULATE (
        MAX ( fact_Economic_Details[Production_Date] ),
        REMOVEFILTERS ()
    )
VAR result =
    IF (
        firstvisibledate <= lastproddate,
        CALCULATE (
            [Gross Production Volume], --this is a basic sum calculation
            'dim_Date'[Date] <= lastvisibledate
        )
    )
RETURN
    result

 

I want to get the value of this measure at the 12 month mark. Any idea how to implement this?

2 REPLIES 2
Greg_Deckler
Super User
Super User

@Syk So 12 months in the past or for the last 12 months only? Maybe something like this?

Last 12 Months = 
  VAR __Today = TODAY()
  VAR __12MonthsAgo = EOMONTH( __Today, -12)
  VAR __MinDate = DATE(YEAR(__12MonthsAgo), MONTH(__12Months), 1)
  VAR __Table = SUMMARIZE( 'fact_Economic_Details',[Production_Date], "__Value", [Cumulative measure])
  VAR __Result = SUMX(__Table, [__Value])
RETURN
  __Result

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

The cumulative measure that I have starts at the first month of production (for a given entity). I need the first 12 months of production. The date ranges will be different for each entity as they start producing at different dates.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors