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
SBIM
Helper I
Helper I

MTD Measure Showing Prior Month Results

I have a measure that uses a fiscal year and month to sum the most recent month like this. 

 

FMTDSales = CALCULATE(
    SUM(JobsWithMilestones[GrossAmount]),
    JobsWithMilestones[ContractfiscalYearMonth] = MAX(JobsWithMilestones[ContractfiscalYearMonth])
)
 
It works perfectly except at the beginning of each month any market that does not yet have a contract entered still shows a sum of the prior month. So my total is fine, but the individual market numbes are way off since it is showing their prior month's data.
 
SBIM_0-1682966357440.png

 

I know it is showing the max contract year and month for those markets, but is this expected behavior? Is there a way to make it show nothing for those markets that have no contracts yet so I they match the total?

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@SBIM 

Try it like this where we get the max MonthYear across all markets and use that.

FMTDSales =
VAR _MonthYear =
    CALCULATE (
        MAX ( JobsWithMilestones[ContractfiscalYearMonth] ),
        ALL ( JobsWithMilestones[Market] )
    )
RETURN
    CALCULATE (
        SUM ( JobsWithMilestones[GrossAmount] ),
        JobsWithMilestones[ContractfiscalYearMonth] = _MonthYear
    )

View solution in original post

2 REPLIES 2
jdbuchanan71
Super User
Super User

@SBIM 

Try it like this where we get the max MonthYear across all markets and use that.

FMTDSales =
VAR _MonthYear =
    CALCULATE (
        MAX ( JobsWithMilestones[ContractfiscalYearMonth] ),
        ALL ( JobsWithMilestones[Market] )
    )
RETURN
    CALCULATE (
        SUM ( JobsWithMilestones[GrossAmount] ),
        JobsWithMilestones[ContractfiscalYearMonth] = _MonthYear
    )

That did the trick thanks for the quick response.

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.