|Task| DAX Measures
Steps:
- Create a measure to show Total Sales
- Create A DAX Measure named USA Sales to show all sales made in USA
- Create A DAX Measure named Non USA Sales to show all sales made outside the USA
- Create A DAX Measure named Last Year Sales to show the Previous Year Sales
- Create A DAX Measure named YoY% to show the percent of Year over Year growth (% difference)
- Create A DAX Measure(s) named Total Profit to show Profit (Total Sales – Cost of Goods Sold) Note: to find Cost of goods sold you must multiply [Cost of Goods] by [Price] – on a row by row basis. In our example the Cost of goods is a percentage of the Sales column. So if a single row has a Sales price of $100 and the Cost Of Goods = 0.8, our actual cost of goods would be $100 * 0.8 = $80. Meaning we would make $20 Revenue on the sale of this single product.
USA Sales =
CALCULATE ( [Total Sales] , Region[Location] = "USA" )
Non USA Sales =
CALCULATE ( [Total Sales] , Region[Location] <> "USA" )
Last Year Sales =
CALCULATE ( [Total Sales] , SAMEPERIODLASTYEAR('Dates'[Date]) )
YoY% =
DIVIDE( [Total Sales] - [Last Year Sales] ,[Last Year Sales] )
First, create the column:
Cost of Goods Sold =
SUMX( Sales ,Sales[Sales] * Sales[Cost of Goods] )
Then create the measure:
Total Profit =
[Total Sales] - [Cost of Goods Sold