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
Anonymous
Not applicable

How to Calculate MTD and total of the "amt" column from all the data available.

Hi,

 

I have the request to show the total "Amt" for ALL the data available in the table. (I need to ignore the time slicer)
and the "Amt" of the latest month from the date range selected in the slicer.

 

Data available in the table is for the date range:01/01/2018 - 03/06/2018
Slicer selected on the report(mm/dd/yyyy): 08/01/2017 to 11/30/2017

 

MTD should show the AMT of November 2017 (latest month selected in the slicer)

 

Total should the AMT of 01/01/2017 - 03/05/2018 (All the available data from sales table)

 

Example:
Product        MTD        Total
abc               4              13
     a1            3               9
         b1       1                4
def               8               12
     d1           3                6
          e1      5                6


MTD is working fine. And the DAX I am using for MTD is

 

MTD =
VAR Year = YEAR ( MAX ( 'Fact - Sales'[MonthEndDate] ) )
VAR Month = MONTH ( MAX ( 'Fact - Sales'[MonthEndDate] ) )

 

RETURN

CALCULATE(

            SUM('Fact - Sales'[Amt]),
            FILTER(
                 ALL('Dim - Date'),
                 'Dim - Date'[Calendar Year] = Year
                 && 'Dim - Date'[Month Of Year] = Month)
)


How I can get the "Total" Measure ignoring the Date slicer?

2 REPLIES 2
Anonymous
Not applicable

@v-ljerr-msft Thank you for the reply. 

 

I have tried that, but the "total" is showing same for every row. 

Product        MTD        Total
abc               4               25
     a1            3               25
         b1       1                25
def               8                25
     d1           3                25
          e1      5                25

 

Expected results are 

Product        MTD        Total
abc               4               13
     a1            3               9
         b1       1                4
def               8                12
     d1           3                6
          e1      5                6

v-ljerr-msft
Employee
Employee

Hi @Anonymous,

Total should the AMT of 01/01/2017 - 03/05/2018 (All the available data from sales table)

The formula below should work in this scenario. Smiley Happy

Total Amount = CALCULATE ( SUM ( 'Fact - Sales'[Amt] ), ALL ( 'Fact - Sales' ) )

 

Regards

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.