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.
I have a dataset that look something like this -->
Customer | Class of Trade | Sales | Profit $ | Profit Margin | Profit Margin COT | Profit Margin Nat'l |
Retailer A | Grocery | 110 | 50 | 45% | 38% | 36% |
Retailer B | Grocery | 100 | 30 | 30% | 38% | 36% |
Retailer C | Mass Merch | 150 | 60 | 40% | 40% | 36% |
Retailer D | Drug Store | 100 | 25 | 25% | 28% | 36% |
Retailer E | Drug Store | 80 | 28 | 35% | 28% | 36% |
I want to create 2 new measures to capture the calculated profit margin of the associated class of trade and total.
So for example if I choose Retailer B si should see the margin for that dataset but also the calculated margin for total Grocery and total all customers.
There may also be an instance where a user may select both Retail B (Grocery) and Retailer E (Drug Store) in which the COT Profit Margin should be total Grocery and Drug Store combined.
How do I do this in Dax?
is this what you need @nj-matt
If I select Mass Merc in the slicer, the total GP% will still be 11.11 % since it is a percent of the total sales - 540/60
The measure code is:
GP% of Total =
VAR varTotalSales =
CALCULATE(
SUM('DataTable'[Sales]),
REMOVEFILTERS('DataTable')
)
VAR varProfit = SUM('DataTable'[Profit $])
RETURN
DIVIDE(
varProfit,
varTotalSales,
0
)
If that isn't what you want, please provide expected results and the formula you are using to get that result.
How to get good help fast. Help us help you.
How To Ask A Technical Question If you Really Want An Answer
How to Get Your Question Answered Quickly - Give us a good and concise explanation
How to provide sample data in the Power BI Forum - Provide data in a table format per the link, or share an Excel/CSV file via OneDrive, Dropbox, etc.. Provide expected output using a screenshot of Excel or other image. Do not provide a screenshot of the source data. I cannot paste an image into Power BI tables.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingThanks, but no - I Am not looking for a % of total sales - the new measures are really just a reference.
So for example, if I choose a drug store retailer - I want to see how the profit margin of that retailer compares to the profit margin of all retailers in the same class of trade.
I'll repeat this info. Perhaps someone else can read what you mean and provide measures and guess right. I need examples of data and output.
How to get good help fast. Help us help you.
How To Ask A Technical Question If you Really Want An Answer
How to Get Your Question Answered Quickly - Give us a good and concise explanation
How to provide sample data in the Power BI Forum - Provide data in a table format per the link, or share an Excel/CSV file via OneDrive, Dropbox, etc.. Provide expected output using a screenshot of Excel or other image. Do not provide a screenshot of the source data. I cannot paste an image into Power BI tables.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingCovering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
49 | |
26 | |
21 | |
15 | |
12 |
User | Count |
---|---|
57 | |
49 | |
44 | |
19 | |
18 |