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.
Dear community,
I would like to calculate the revenue per capita for a product in a specified country.
I tried to put this into a dax expression, without success.
My data structure is as follows:
Table A
Country | Product | Revenue |
Country A | Product A | 100 |
Country A | Product B | 200 |
Country B | Product A | 50 |
Country B | Product C | 100 |
… |
Table B
Country | Population |
Country A | 100000 |
Country B | 200000 |
Country C | 50000 |
… |
Table A and Table B are linked in both ways on the column "Country"
I have tried this DAX expression without success, for every product I get the same value.
Solved! Go to Solution.
Hi @skean21 please create this measure in tableA.
Measure =
VAR _country = MAX(TableA[Country])
VAR _population = CALCULATE(SUM(TableB[Population]),TableB[Country]=_country)
VAR _revenue = SUM(TableA[Revenue])
RETURN DIVIDE(_revenue,_population,0)
Hi @skean21 please create this measure in tableA.
Measure =
VAR _country = MAX(TableA[Country])
VAR _population = CALCULATE(SUM(TableB[Population]),TableB[Country]=_country)
VAR _revenue = SUM(TableA[Revenue])
RETURN DIVIDE(_revenue,_population,0)
Covering 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 |
---|---|
47 | |
23 | |
20 | |
15 | |
13 |
User | Count |
---|---|
51 | |
42 | |
39 | |
19 | |
19 |