Skip to main content
|

PowerPivotPro's FAQ Site

Go Search
  
PowerPivotPro's FAQ Site > The Great PowerPivot FAQ > DAX Measure to calculate MTD Sales For This Region  

The Great PowerPivot FAQ: DAX Measure to calculate MTD Sales For This Region

Title

DAX Measure to calculate MTD Sales For This Region 

Answer

Say that you have a pivot table with regions across the top and daily dates down the side.
 
To calculate MTD sales for this region, use:
=Calculate(Sum(Fact[Sales]),
    DatesMTD(Fact[Date]),
    AllExcept(Fact,Fact[Region]))
 
Breaking this down:
The expression asks for sum of sales.
Filter 1 says for all dates up included in MTD of this row
Filter 2 says to respect the current column's filter for region.
 
If instead you wanted MTD sales across all regions:
=Calculate(Sum(Fact[Sales]),
    DatesMTD(Fact[Date]),
    All(Fact))
 
If you wanted to see this region's MTD sales as a percentage of total MTD sales:
=Calculate(Sum(Fact[Sales]),
    DatesMTD(Fact[Date]),
    AllExcept(Fact,Fact[Region]))/
Calculate(Sum(Fact[Sales]),
    DatesMTD(Fact[Date]),
    All(Fact))

MTD is only one example. You can extend this concept to any of the Time Intelligence functions. See a complete list of time intelligence functions at the bottom of Vidas Matelis' list of DAX Functions: http://powerpivot-info.com/post/53-list-of-powerpivot-dax-functions-short
 
 

Client/Server

Client 

Topic

F - Calculations (DAX) 

Purpose

Information 

Answered?

Yes 

Contributor

Bill Jelen 

Título

 

Resposta

 

Frage

Wie erstelle ich mit DAX eine "MTD Umsatz" Kennzahl? 

Antwort

 

preRTM

 
Attachments
Created at 1/14/2010 10:18 AM  by Bill Jelen 
Last modified at 4/23/2010 1:29 PM  by Jochen Juelke