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
OneWithQuestion
Post Prodigy
Post Prodigy

Month to Date but with cumulative grand total?

I am using TotalMTD to SUM up sales per month.

 

It works great at the day level as it sums each day's sales up to the month to date total.

 

However, for the entire grand total I want YTD not the value of the most recent month in the year:

 

DesiredGrantTotal.PNG

 

How do I adjust my measure so that when at the grand total level for year it shows 610 (all 4 months added) instead of 180 which is the MTD value of the most recent month?

 

Thanks!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hey @OneWithQuestion,

 

You can achieve this by using the HASONEFILTER function, because the row data will contain a filter and the grand total will not. Your measure will look something like:

 

RealMonthlySum = 
IF(
    HASONEFILTER(Table1[Date]),
    TOTALMTD(SUM(Table1[SalesAmount]), Table1[Date]),
    SUM(Table1[SalesAmount])
)

If you want further explanation, you can watch a video tutorial I posted here.

 

Hope this helps,

Parker

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hey @OneWithQuestion,

 

You can achieve this by using the HASONEFILTER function, because the row data will contain a filter and the grand total will not. Your measure will look something like:

 

RealMonthlySum = 
IF(
    HASONEFILTER(Table1[Date]),
    TOTALMTD(SUM(Table1[SalesAmount]), Table1[Date]),
    SUM(Table1[SalesAmount])
)

If you want further explanation, you can watch a video tutorial I posted here.

 

Hope this helps,

Parker

Thank you, HasOneFilter was perfect!  I was playing around with HasOneValue but the filter is so much more versitile.

 

 

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.