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
KW123
Helper V
Helper V

MTD total showing Sum for the year instead

Hi, 

I have a Dates table as well as a separate Goals table. The Goals table contains a list of the 12 months, and a column with each monthly goal.  

I need a MTD column in my report that will show the MTD goals added together for the sliced months.  So if I have it sliced on May for example, it will show the goal total for Jan-May.  

MTD Goal =
TOTALMTD(SUM('2022 Goals'[Goal]),Dates[Date])

However on the report, the Goal comes out as the total for the entire year, no matter which month is sliced.  Is there a way to fix this? 

Thanks, 

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

Hi @KW123 ,

According to your description, I create a sample.

2022 Goals table:

vkalyjmsft_0-1658904832789.png

Dates table:

vkalyjmsft_1-1658904911820.png

The two tables are related with the Month column.

In your formula, there're two errors, first is the ALLSELECTED function, it only takes the values be selected in the slicer into consideration, replace it with ALL function. Then filter the all date table, not only the date column. Modify the formula to:

Measure =
CALCULATE (
    SUM ( '2022 Goals'[Goal] ),
    FILTER (
        ALL ( 'Dates' ),
        ISONORAFTER ( 'Dates'[Date], MAX ( 'Dates'[Date] ), DESC )
    )
)

Get the correct result.

vkalyjmsft_2-1658905503986.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

5 REPLIES 5
v-yanjiang-msft
Community Support
Community Support

Hi @KW123 ,

According to your description, I create a sample.

2022 Goals table:

vkalyjmsft_0-1658904832789.png

Dates table:

vkalyjmsft_1-1658904911820.png

The two tables are related with the Month column.

In your formula, there're two errors, first is the ALLSELECTED function, it only takes the values be selected in the slicer into consideration, replace it with ALL function. Then filter the all date table, not only the date column. Modify the formula to:

Measure =
CALCULATE (
    SUM ( '2022 Goals'[Goal] ),
    FILTER (
        ALL ( 'Dates' ),
        ISONORAFTER ( 'Dates'[Date], MAX ( 'Dates'[Date] ), DESC )
    )
)

Get the correct result.

vkalyjmsft_2-1658905503986.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

KW123
Helper V
Helper V

I've tried it as a running total calculation too, and it just adds all 12 months of goals together instead of just up until the sliced month

CALCULATE(
    SUM('2022 Goals'[Goal]),
    FILTER(
        ALLSELECTED('Dates'[Date]),
        ISONORAFTER('Dates'[Date], MAX('Dates'[Date]), DESC)
    )
)
KW123
Helper V
Helper V

Thanks @amitchandak 
Neither of those DAX work for what I am trying to acheive.  It is still showing each row as the YTD goal total rather than up to the current month. 

@KW123 ,
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

amitchandak
Super User
Super User

@KW123 , First of MTD is only needed when you show data date-wise month onward you can use

SUM('2022 Goals'[Goal])

 

or YTD

YTD Goal =
TOTALYTD(SUM('2022 Goals'[Goal]),Dates[Date])

 

Or change grand total

if(isinscope(Table[Visual Column]),
TOTALMTD(SUM('2022 Goals'[Goal]),Dates[Date]) , SUM('2022 Goals'[Goal]))

 

https://www.kasperonbi.com/use-isinscope-to-get-the-right-hierarchy-level-in-dax/

 

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.

Top Solution Authors